Пример #1
0
function insert_compose_frame($id, $newtopic = true, $quote = false, $attachment = false)
{
    global $CURUSER, $INSTALLER09, $Multi_forum;
    $htmlout = '';
    if ($newtopic) {
        $res = sql_query("SELECT name FROM forums WHERE id=" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysqli_fetch_assoc($res) or die("Bad forum ID!");
        // $htmlout .="<h3>New topic in <a href='{$INSTALLER09['baseurl']}/forums.php?action=viewforum&amp;forumid=".$id."'>".htmlsafechars($arr["name"])."</a> forum</h3>";
        $htmlout .= "<!--<div class='navigation'>\n\t\t\t\t<a href='index.php'>" . $INSTALLER09["site_name"] . "</a> \n\t\t\t\t&gt;\n\t\t\t\t<a href='forums.php'>Forums</a>\n\t\t\t\t&gt;\n\t\t\t\t<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewforum&amp;forumid=" . $id . "'>" . htmlsafechars($arr["name"]) . "</a>\n\t\t\t\t<br><img src='templates/1/pic/carbon/nav_bit.png' alt=''>\n\t\t\t\t<span class='active'>New Topic</span>\n\t\t\t\t</div><br />-->";
    } else {
        $res = sql_query("SELECT t.forum_id, t.topic_name, t.locked, f.min_class_read, f.name AS forum_name FROM topics AS t LEFT JOIN forums AS f ON f.id = t.forum_id WHERE t.id=" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysqli_fetch_assoc($res) or die("Forum error, Topic not found.");
        $forum = htmlsafechars($arr["forum_name"]);
        $forumid = (int) $arr['forum_id'];
        if ($arr['locked'] == 'yes') {
            stderr("Sorry", "The topic is locked.");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Compose", true, $stdhead) . $htmlout . stdfoot($stdfoot);
            exit;
        }
        if ($CURUSER["class"] < $arr["min_class_read"]) {
            $htmlout .= stdmsg("Sorry", "You are not allowed in here.");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Compose") . $htmlout . stdfoot();
            exit;
        }
        $htmlout .= "<!--<div class='navigation'>\n\t\t\t\t<a href='index.php'>" . $INSTALLER09["site_name"] . "</a> \n\t\t\t\t&gt;\n\t\t\t\t<a href='forums.php'>Forums</a>\n\t\t\t\t&gt;\n\t\t\t\t<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewforum&amp;forumid=" . $forumid . "'>{$forum}</a>\n\t\t\t\t&gt;\n\t\t\t\t<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewtopic&amp;topicid=" . $id . "'>" . htmlsafechars($arr["topic_name"]) . "</a>\n\t\t\t\t<br><img src='templates/1/pic/carbon/nav_bit.png' alt=''>\n\t\t\t\t<span class='active'>Post Reply</span>\n\t\t\t\t</div><br />-->";
        // $htmlout .="<h3 align='center'>Reply to topic:<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewtopic&amp;topicid=".$id."'>".htmlsafechars($arr["topic_name"])."</a></h3>";
    }
    $htmlout .= "\n    <script type='text/javascript'>\n    /*<![CDATA[*/\n    function Preview()\n    {\n    document.compose.action = './forums/preview.php'\n    document.compose.target = '_blank';\n    document.compose.submit();\n    return true;\n    }\n    /*]]>*/\n    </script>";
    //$htmlout .= begin_frame("Compose", true);
    $htmlout .= "<form method='post' name='compose' action='{$INSTALLER09['baseurl']}/forums.php' enctype='multipart/form-data'>\n\t  <input type='hidden' name='action' value='post' />\n\t  <input type='hidden' name='" . ($newtopic ? 'forumid' : 'topicid') . "' value='" . $id . "' />";
    //$htmlout .= begin_table(true);
    $htmlout .= "<table border='0' cellspacing='0' cellpadding='5' class='tborder'>\n\t<tr>\n<td class='thead' colspan='2'><strong>Compose</strong></td>\n</tr>\n\t";
    if ($newtopic) {
        $htmlout .= "<tr>\n\t\t\t<td class=row width='10%'>Subject</td>\n\t\t\t<td class=row align='left'>\n\t\t\t\t<input type='text' class='form-control col-md-12' size='100' maxlength='{$Multi_forum['configs']['maxsubjectlength']}' name='topic_name'  />\n\t\t\t</td>\n\t\t</tr>";
    }
    if ($quote) {
        $postid = (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            stderr("Error", "Invalid ID!");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Compose", true, $stdhead) . $htmlout . stdfoot($stdfoot);
            exit;
        }
        $res = sql_query("SELECT posts.*, users.username FROM posts JOIN users ON posts.user_id = users.id WHERE posts.id =" . sqlesc($postid)) or sqlerr(__FILE__, __LINE__);
        if (mysqli_num_rows($res) == 0) {
            stderr("Error", "No post with this ID");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Error - No post with this ID", true, $stdhead) . $htmlout . stdfoot($stdfoot);
            exit;
        }
        $arr = mysqli_fetch_assoc($res);
    }
    $htmlout .= "<tr>\n\t\t<td class=row valign='top'>Body</td>\n\t\t<td class=row>";
    $qbody = $quote ? "[quote=" . htmlsafechars($arr["username"]) . "]" . htmlsafechars($arr["body"]) . "[/quote]" : "";
    //if (function_exists('BBcode'))
    //$htmlout .= BBcode($qbody, true);
    if (function_exists('textbbcode')) {
        $htmlout .= ' 
		' . textbbcode('compose', 'body', isset($qbody) ? htmlsafechars($qbody) : '') . ' 
		';
    } else {
        $htmlout .= "<textarea name='body' style='width:99%' rows='7'>{$qbody}</textarea>";
    }
    $htmlout .= "</td></tr>";
    if ($Multi_forum['configs']['use_attachment_mod'] && $attachment) {
        $htmlout .= "<tr>\n\t\t\t\t<td colspan='2'><fieldset class='fieldset'><legend>Add Attachment</legend>\n\t\t\t\t<input type='checkbox' name='uploadattachment' value='yes' />\n\t\t\t\t<input type='file' name='file' size='60' />\n        <div class='error'>Allowed Files: rar, zip<br />Size Limit " . mksize($Multi_forum['configs']['maxfilesize']) . "</div></fieldset>\n\t\t\t\t</td>\n\t\t\t</tr>";
    }
    $htmlout .= "<tr>\n   \t  <td class=row align='center' colspan='2'>" . post_icons() . "</td>\n \t     </tr><tr class=row>\n \t\t  <td colspan='2' align='center'>\n \t     <input class='btn btn-primary dropdown-toggle' type='submit' value='Submit' /><input class='btn btn-primary dropdown-toggle' type='button' value='Preview' name='button2' onclick='return Preview();' />\n";
    if ($newtopic) {
        $htmlout .= "Anonymous Topic<input type='checkbox' name='anonymous' value='yes'/>\n";
    } else {
        $htmlout .= "Anonymous Post<input type='checkbox' name='anonymous' value='yes'/>\n";
    }
    $htmlout .= "</td></tr></form>\n";
    $htmlout .= "<tr>\n\t\t\t\t<td colspan='2' align='right' class='tfoot'>\n\t\t\t\t" . insert_quick_jump_menu() . "\n\t\t\t\t</td>\n\t\t\t</tr>";
    $htmlout .= end_table();
    $htmlout .= "<br />";
    // $htmlout .= end_frame();
    // ------ Get 10 last posts if this is a reply
    if (!$newtopic && $INSTALLER09['show_last_10']) {
        $postres = sql_query("SELECT p.id, p.added, p.body, p.anonymous, u.id AS uid, u.enabled, u.class, u.donor, u.warned, u.chatpost, u.leechwarn, u.pirate, u.king, u.username, u.avatar, u.offensive_avatar " . "FROM posts AS p " . "LEFT JOIN users AS u ON u.id = p.user_id " . "WHERE p.topic_id=" . sqlesc($id) . " " . "ORDER BY p.id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        if (mysqli_num_rows($postres) > 0) {
            $htmlout .= "<br />";
            $htmlout .= begin_frame("10 last posts, in reverse order");
            while ($post = mysqli_fetch_assoc($postres)) {
                //$avatar = ($CURUSER["avatars"] == "all" ? htmlsafechars($post["avatar"]) : ($CURUSER["avatars"] == "some" && $post["offavatar"] == "no" ? htmlsafechars($post["avatar"]) : ""));
                $avatar = $CURUSER["avatars"] == "yes" ? avatar_stuff($post) : "";
                if ($post['anonymous'] == 'yes') {
                    $avatar = $INSTALLER09['pic_base_url'] . $Multi_forum['configs']['forum_pics']['default_avatar'];
                } else {
                    $avatar = $CURUSER["avatars"] == "yes" ? avatar_stuff($post) : '';
                }
                if (empty($avatar)) {
                    $avatar = $INSTALLER09['pic_base_url'] . $Multi_forum['configs']['forum_pics']['default_avatar'];
                }
                $user_stuff = $post;
                $user_stuff['id'] = (int) $post['uid'];
                if ($post["anonymous"] == "yes") {
                    if ($CURUSER['class'] < UC_STAFF && $post["uid"] != $CURUSER["id"]) {
                        $htmlout .= "<p class='sub'>#" . (int) $post["id"] . " by <i>Anonymous</i> at " . get_date($post["added"], 'LONG', 1, 0) . "</p>";
                    } else {
                        $htmlout .= "<p class='sub'>#" . (int) $post["id"] . " by <i>Anonymous</i> [<b>" . format_username($user_stuff, true) . "</b>] at " . get_date($post["added"], 'LONG', 1, 0) . "</p>";
                    }
                } else {
                    $htmlout .= "<p class='sub'>#" . (int) $post["id"] . " by " . (!empty($post["username"]) ? format_username($user_stuff, true) : "unknown[" . (int) $post['uid'] . "]") . " at " . get_date($post["added"], 'LONG', 1, 0) . "</p>";
                }
                $htmlout .= begin_table(true);
                $htmlout .= "<tr>\n\t\t\t\t <td height='100' width='100' align='center' style='padding: 0px' valign='top'><img height='100' width='100' src='" . $avatar . "' alt='User avvy' /></td>\n\t\t\t\t <td class='comment' valign='top'>" . format_comment($post["body"]) . "</td>\n\t\t\t\t </tr>";
                $htmlout .= end_table();
            }
            $htmlout .= end_frame();
        }
    }
    //$htmlout .= insert_quick_jump_menu();
    return $htmlout;
}
Пример #2
0
function insert_compose_frame($id, $newtopic = true, $quote = false, $attachment = false)
{
    global $maxsubjectlength, $CURUSER, $max_torrent_size, $maxfilesize, $pic_base_url, $use_attachment_mod, $forum_pics, $DEFAULTBASEURL;
    if ($newtopic) {
        $res = sql_query("SELECT name FROM forums WHERE id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or die("Bad forum ID!");
        ?>
<h3>New topic in <a href='<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?action=viewforum&amp;forumid=<?php 
        echo $id;
        ?>
'><?php 
        echo safeChar($arr["name"]);
        ?>
</a> forum</h3><?php 
    } else {
        $res = sql_query("SELECT subject, locked FROM topics WHERE id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or die("Forum error, Topic not found.");
        if ($arr['locked'] == 'yes') {
            stdmsg("Sorry", "The topic is locked.");
            end_table();
            end_main_frame();
            stdfoot();
            exit;
        }
        ?>
<h3 align="center"><?php 
        echo $language['replyto'];
        ?>
<a href='<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
action=viewtopic&amp;topicid=<?php 
        echo $id;
        ?>
'><?php 
        echo safeChar($arr["subject"]);
        ?>
</a></h3><?php 
    }
    begin_frame("Compose", true);
    ?>
<form method='post' name='compose' action='<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
' enctype='multipart/form-data'>
	<input type="hidden" name="action" value="post" />
	<input type='hidden' name='<?php 
    echo $newtopic ? 'forumid' : 'topicid';
    ?>
' value='<?php 
    echo $id;
    ?>
' /><?php 
    begin_table(true);
    if ($newtopic) {
        ?>
		<tr>
			<td class='rowhead' width="10%">Subject</td>
			<td align='left'>
				<input type='text' size='100' maxlength='<?php 
        echo $maxsubjectlength;
        ?>
' name='subject' style='height: 19px' />
			</td>
		</tr><?php 
    }
    if ($quote) {
        $postid = (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            stdmsg("Error", "Invalid ID!");
            end_table();
            end_main_frame();
            stdfoot();
            exit;
        }
        $res = sql_query("SELECT posts.*, users.username FROM posts JOIN users ON posts.userid = users.id WHERE posts.id = {$postid}") or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($res) == 0) {
            stdmsg("Error", "No post with this ID");
            end_table();
            end_main_frame();
            stdfoot();
            exit;
        }
        $arr = mysql_fetch_assoc($res);
    }
    ?>
<tr>
		<td class='rowhead' width="10%">Body</td>
		<td><?php 
    $qbody = $quote ? "[quote=" . safeChar($arr["username"]) . "]" . safeChar(unesc($arr["body"])) . "[/quote]" : '';
    if (function_exists('textbbcode')) {
        textbbcode("compose", "body", $qbody);
    } else {
        ?>
<textarea name="body" style="width:99%" rows="7"><?php 
        echo $qbody;
        ?>
</textarea><?php 
    }
    if ($use_attachment_mod && $attachment) {
        ?>
<tr>
				<td colspan='2'><fieldset class="fieldset"><legend>Add attachment</legend>
					<input type='checkbox' name='uploadattachment' value='yes' />
					<input type="file" name="file" size="60" />
                    <div class='error'>Allowed files: rar, zip<br />Max file size: <?php 
        echo prefixed($maxfilesize);
        ?>
</div></fieldset>
				</td>
			</tr><?php 
    }
    ?>
		<tr>
		<td align=center colspan=2>
		<?php 
    echo post_icons();
    ?>
		</td>
	</tr>
		<tr>
        	<td colspan='2' align='center'>
            <input type='submit' value='Submit' />
			</td>
		</tr>

		</td>
        </tr><?php 
    end_table();
    ?>
</form><?php 
    end_frame();
    // ------ Get 10 last posts if this is a reply
    if (!$newtopic) {
        $postres = sql_query("SELECT p.id, p.added, p.body, u.id AS uid, u.username, u.avatar " . "FROM posts AS p " . "LEFT JOIN users AS u ON u.id = p.userid " . "WHERE p.topicid = " . sqlesc($id) . " " . "ORDER BY p.id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($postres) > 0) {
            ?>
<br /><?php 
            begin_frame("Last 10 post's in reverse order");
            while ($post = mysql_fetch_assoc($postres)) {
                $avatar = $CURUSER["avatars"] == "yes" ? safeChar($post["avatar"]) : '';
                if (empty($avatar)) {
                    $avatar = $pic_base_url . $forum_pics['default_avatar'];
                }
                ?>
<p class=sub>#<?php 
                echo $post["id"];
                ?>
 by <?php 
                echo !empty($post["username"]) ? $post["username"] : "******";
                ?>
 at <?php 
                echo $post["added"];
                ?>
 GMT</p><?php 
                begin_table(true);
                ?>
					<tr>
						<td height='100' width='100' align='center' style='padding: 0px' valign="top"><img height='100' width='100' src="<?php 
                echo $avatar;
                ?>
" /></td>
						<td class='comment' valign='top'><?php 
                echo format_comment($post["body"]);
                ?>
</td>
					</tr><?php 
                end_table();
            }
            end_frame();
        }
    }
    insert_quick_jump_menu();
}
Пример #3
0
		[<a class="altlink" href="staffpanel.php?tool=forum_manage&amp;action=forum_manage&amp;action2=edit_forum_page&amp;id=' . $forum_id . '">Edit</a>] 
		[<a class="altlink" href="javascript:confirm_delete(\'' . $forum_id . '\');">Delete</a>]</span>' : '') . '<br />
		<span style="font-size: x-small;"> ' . $forum_description . '</span>' . $child_boards . '</td>
		</tr>
		</table>
		</td>
		<td class="' . $class . '" align="center" width="80"><span style="font-size: x-small;">' . $post_count . ' Posts<br />' . $topic_count . ' Topics</span></td>
		<td class="' . $class . '" align="left" width="140"><span style="font-size: x-small;">' . $last_post . '</span></td>
		</tr>';
            }
            //== end of sectioon
            $over_forum_id = $arr_forums['over_forum_id'];
            $child_boards = '';
        }
        //=== end while loop!
        $HTMLOUT .= '</table><br />' . $location_bar . insert_quick_jump_menu() . '<br />';
        //=== members active in forums
        $active_members_res = sql_query('SELECT n_v.user_id, u.id, u.username, u.class, u.donor, u.warned, u.suspended, u.enabled, u.chatpost, u.leechwarn, u.pirate, u.king, u.avatar_rights FROM now_viewing AS n_v LEFT JOIN users AS u ON n_v.user_id = u.id');
        //=== let's see whos lookng in here...
        $now_viewing = '';
        while ($active_members_arr = mysql_fetch_assoc($active_members_res)) {
            $now_viewing .= print_user_stuff($active_members_arr);
        }
        $HTMLOUT .= '<table border="0" cellspacing="5" cellpadding="5" style="max-width:80%;min-width:600px;" align="center">
    <tr>
    <td class="forum_head_dark" align="center">Members currently active</td>
    </tr>
    <tr>
    <td class="three" align="center">' . $now_viewing . '</td>
    </tr>
    </table><br />' . $legend . stdfoot();
Пример #4
0
            $HTMLOUT .= "<a href='{$INSTALLER09['baseurl']}/forums.php?action=quotepost&amp;topicid=" . $topicid . "&amp;postid=" . $postid . "' class='postbit_quote' ><span>Quote</span></a>";
        }
    } else {
        $HTMLOUT .= "<a href='{$INSTALLER09['baseurl']}/forums.php?action=quotepost&amp;topicid=" . $topicid . "&amp;postid=" . $postid . "' class='postbit_quote' ><span>Quote</span></a>";
    }
    if ($CURUSER['class'] >= UC_STAFF || isMod($forumid, "forum")) {
        $HTMLOUT .= "<a href='{$INSTALLER09['baseurl']}/forums.php?action=deletepost&amp;postid=" . $postid . "' class='postbit_qdelete'><span>Delete</span></a>";
    }
    if ($CURUSER["id"] == $posterid && !$locked || $CURUSER['class'] >= UC_STAFF || isMod($forumid, "forum")) {
        $HTMLOUT .= "<a href='{$INSTALLER09['baseurl']}/forums.php?action=editpost&amp;postid=" . $postid . "' class='postbit_edit'><span>Edit</span></a>";
    }
    $HTMLOUT .= "<a href='#top' class='postbit_goup'><span>Up</span></a>";
    $HTMLOUT .= "</div>\n</div>\n</div></div></td></tr>";
}
$HTMLOUT .= "<tr>\n            <td class='tfoot'>\n    <div class='float_right'>";
$HTMLOUT .= insert_quick_jump_menu($forumid);
$HTMLOUT .= "</div>\n    </td>\n        </tr>\n    </table><br />";
// end of posts
$HTMLOUT .= "<div style='padding-top: 4px;' class='float_right'>";
// ------ "View unread" / "Add reply" buttons
$HTMLOUT .= "<a href='forums.php?action=viewunread' class='button new_reply_button'><span>Show New</span></a>&nbsp;";
if ($maypost) {
    $HTMLOUT .= "<a href='forums.php?action=reply&topicid=" . $topicid . "' class='button new_reply_button'><span>New Reply</span></a>&nbsp;";
}
$HTMLOUT .= "</div><br /><br /><br />";
if ($locked) {
    $HTMLOUT .= "";
} else {
    $HTMLOUT .= "<div class='float_left' style='margin-top:-4em'>";
    $HTMLOUT .= $pagemenu1 . $pmlb . $pagemenu2 . $pmlb . $pagemenu3;
    if ($Multi_forum['configs']['use_poll_mod'] && (($userid == $t_userid || $CURUSER['class'] >= UC_STAFF || isMod($forumid, "forum")) && !is_valid_id($pollid))) {
Пример #5
0
function insert_compose_frame($id, $newtopic = true, $quote = false)
{
    global $maxsubjectlength, $db;
    MCached::connect();
    if ($newtopic) {
        $arr = MCached::get('forums::name::' . $id);
        if ($arr === MCached::NO_RESULT) {
            $res = $db->query("SELECT name FROM forums WHERE id = " . $id) or sqlerr(__FILE__, __LINE__);
            $arr = $res->fetch_assoc() or die(BAD_FORUM_ID);
            MCached::add('forums::name::' . $id, $arr, 9600);
        }
        $forumname = security::html_safe(unesc($arr["name"]));
        block_begin(WORD_NEW . " " . TOPIC . " " . IN . " <a href='?action=viewforum&forumid=" . $id . "'>" . $forumname . "</a> " . FORUM);
    } else {
        $arr = MCached::get('quick::jump::topics::' . $id);
        if ($arr === MCached::NO_RESULT) {
            $res = $db->query("SELECT * FROM topics WHERE id = " . $id) or sqlerr(__FILE__, __LINE__);
            $arr = $res->fetch_assoc() or stderr(ERROR, FORUM_ERROR . TOPIC_NOT_FOUND);
            MCached::add('quick::jump::topics::' . $id, $arr, 9600);
        }
        $subject = security::html_safe(unesc($arr["subject"]));
        block_begin(REPLY . " " . TOPIC . ": <a href='?action=viewtopic&topicid=" . $id . "'>" . $subject . "</a>");
    }
    begin_frame();
    print "<form method='post' name='compose' action='?action=post'>\n";
    if ($newtopic) {
        print "<input type='hidden' name='forumid' value='" . $id . "'>\n";
    } else {
        print "<input type='hidden' name='topicid' value='" . $id . "'>\n";
    }
    begin_table();
    if ($newtopic) {
        print "<tr><td class='header'>" . SUBJECT . "</td>" . "<td class='lista' align='left' style='padding: 0px'><input type='text' size='50' maxlength='" . $maxsubjectlength . "' name='subject' " . "style='border: 0px; height: 19px'></td></tr>\n";
    }
    if ($quote) {
        $postid = 0 + (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            die;
        }
        $res = $db->query("SELECT posts.*, users.username FROM posts INNER JOIN users ON posts.userid = users.id WHERE posts.id = " . $postid) or sqlerr(__FILE__, __LINE__);
        if ($res->num_rows != 1) {
            stderr(ERROR, ERR_NO_POST_WITH_ID . "" . $postid);
        }
        $arr = $res->fetch_assoc();
    }
    print "<tr><td class='header'>" . BODY . "</td><td class='lista' align='left' style='padding: 0px'>";
    textbbcode("compose", "body", $quote ? "[quote=" . security::html_safe($arr["username"]) . "]" . security::html_safe(unesc($arr["body"])) . "[/quote]" : "");
    print "<tr><td colspan='2' align='center'><input type='submit' class='btn' value='" . FRM_CONFIRM . "'></td></tr>\n";
    print "</td></tr>";
    end_table();
    print "</form>\n";
    end_frame();
    //------ Get 10 last posts if this is a reply
    if (!$newtopic) {
        $postres = $db->query("SELECT * FROM posts WHERE topicid = " . $id . " ORDER BY id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        begin_frame(LAST_10_POSTS, true);
        while ($post = $postres->fetch_assoc()) {
            //-- Get poster details
            $userres = $db->query("SELECT * FROM users WHERE id = " . (int) $post["userid"] . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
            $user = $userres->fetch_assoc();
            $avatar = $user["avatar"] && $user["avatar"] != "" ? security::html_safe($user["avatar"]) : "";
            begin_table(true);
            print "<tr valign='top'><td width='150' align='center' style='padding: 0px'>#" . (int) $post["id"] . " by " . security::html_safe($user["username"]) . "<br />" . get_date_time($post["added"]) . ($avatar != "" ? "<br /><img width='80' src='" . $avatar . "'>" : "") . "</td><td class='lista'>" . format_comment(unesc($post["body"])) . "</td></tr><br>\n";
            end_table();
        }
        end_frame();
    }
    if (!isset($forumid)) {
        $forumid = 0;
    }
    insert_quick_jump_menu($forumid);
    block_end();
}
Пример #6
0
 function insert_compose_frame($id, $newtopic = true)
 {
     global $maxsubjectlength;
     if ($newtopic) {
         $res = SQL_Query_exec("SELECT name FROM forum_forums WHERE id={$id}");
         $arr = mysql_fetch_assoc($res) or showerror(T_("FORUM_ERROR"), T_("FORUM_BAD_FORUM_ID"));
         $forumname = stripslashes($arr["name"]);
         print "<p align='center'><b>" . T_("FORUM_NEW_TOPIC") . " <a href='forums.php?action=viewforum&amp;forumid={$id}'>{$forumname}</a></b></p>\n";
     } else {
         $res = SQL_Query_exec("SELECT * FROM forum_topics WHERE id={$id}");
         $arr = mysql_fetch_assoc($res) or showerror(T_("FORUM_ERROR"), T_("FORUMS_NOT_FOUND_TOPIC"));
         $subject = stripslashes($arr["subject"]);
         print "<p align='center'>" . T_("FORUM_REPLY_TOPIC") . ": <a href='forums.php?action=viewtopic&amp;topicid={$id}'>{$subject}</a></p>";
     }
     # Language Marker #
     print "<p align='center'>" . T_("FORUM_RULES") . "\n";
     print "<br />" . T_("FORUM_RULES2") . "<br /></p>\n";
     #begin_frame("Compose Message", true);
     print "<fieldset class='download'>";
     print "<legend><b>Compose Message</b></legend>";
     print "<div>";
     print "<form name='Form' method='post' action='?action=post'>\n";
     if ($newtopic) {
         print "<input type='hidden' name='forumid' value='{$id}' />\n";
     } else {
         print "<input type='hidden' name='topicid' value='{$id}' />\n";
     }
     if ($newtopic) {
         print "<center><br /><table cellpadding='3' cellspacing='0'><tr><td><strong>Subject:</strong>  <input type='text' size='70' maxlength='{$maxsubjectlength}' name='subject' /></td></tr>";
         print "<tr><td align='center'>";
         textbbcode("Form", "body");
         print "</td></tr><tr><td align='center'><br /><input type='submit' value='" . T_("SUBMIT") . "' /><br /><br /></td></tr></table>\n\t\t\t";
     }
     print "<br /></center>";
     print "</form>\n";
     print "</div>";
     print "</fieldset><br />";
     #end_frame();
     insert_quick_jump_menu();
 }
			<td class="two" align="center">
			<input type="submit" name="button" class="button" value="' . $lang['vt_lock_topic'] . '" onmouseover="this.className=\'button_hover\'" onmouseout="this.className=\'button\'" />
			</form></td>
      </tr>
       <tr>
			<td class="two" align="center" width="28" valign="top">
	<!-- needed to add later RS.	 -->				
         <img src="' . $INSTALLER09['pic_base_url'] . 'forums/move.gif" alt="' . $lang['vt_move'] . '" title="' . $lang['vt_move'] . '" width="22" /></td>
			<td class="two" align="right" valign="top">
			<span style="font-weight: bold;white-space:nowrap;">' . $lang['vt_move'] . ' ' . $lang['fe_topic'] . ':</span></td>
			<td class="two" align="left" valign="top">
<form action="' . $INSTALLER09['baseurl'] . '/forums.php?action=staff_actions" method="post">
			<input type="hidden" name="action_2" value="move_topic" />
			<input type="hidden" name="topic_id" value="' . $topic_id . '" />
			<select name="forum_id">
			' . insert_quick_jump_menu($forum_id, $staff = true) . '</select></td>
			<td class="two" align="center">
			<input type="submit" name="button" class="button" value="' . $lang['vt_move_topic'] . '" onmouseover="this.className=\'button_hover\'" onmouseout="this.className=\'button\'" />
			</form> <!--//-->
			</td>
      </tr>	
      <tr>
			<td class="two" align="center" width="28" valign="top">
			<img src="' . $INSTALLER09['pic_base_url'] . 'forums/modify.gif" alt="' . $lang['fe_modify'] . '" title="' . $lang['fe_modify'] . '" /></td>
			<td class="two" align="right" valign="top">
			<span style="font-weight: bold;white-space:nowrap;">' . $lang['vt_rename'] . ' ' . $lang['fe_topic'] . ':</span></td>
			<td class="two" align="left" valign="top">
			<form action="' . $INSTALLER09['baseurl'] . '/forums.php?action=staff_actions" method="post">
			<input type="hidden" name="action_2" value="rename_topic" />
			<input type="hidden" name="topic_id" value="' . $topic_id . '" />
			<input type="text" size="40" maxlength="120" name="new_topic_name" value="' . ($topic_name !== '' ? $topic_name : '') . '" /></td>
Пример #8
0
end_frame();
end_main_frame();
print $pagemenu;
if ($locked && get_user_class() < UC_MODERATOR) {
    print "<p>This topic is locked; no new posts are allowed.</p>\n";
} else {
    $arr = get_forum_access_levels($forumid) or die;
    if (get_user_class() < $arr["write"]) {
        print "<p><i>You are not permitted to post in this forum.</i></p>\n";
    } else {
        $maypost = true;
    }
}
//------ "View unread" / "Add reply" buttons
print "<p><table class=main border=0 cellspacing=0 cellpadding=0><tr>\n";
print "<td class=embedded><form method=get action=?>\n";
print "<input type=hidden name=action value=viewunread>\n";
print "<input type=submit value='View Unread' class=btn>\n";
print "</form></td>\n";
if ($maypost) {
    print "<td class=embedded style='padding-left: 10px'><form method=get action=?>\n";
    print "<input type=hidden name=action value=reply>\n";
    print "<input type=hidden name=topicid value={$topicid}>\n";
    print "<input type=submit value='Add Reply' class=btn>\n";
    print "</form></td>\n";
}
print "</tr></table></p>\n";
//------ Forum quick jump drop-down
insert_quick_jump_menu($forumid);
stdfoot();
die;
Пример #9
0
function insert_compose_frame($id, $newtopic = true, $quote = false, $attachment = false)
{
    global $maxsubjectlength, $CURUSER, $TBDEV, $maxfilesize, $use_attachment_mod, $forum_pics;
    $htmlout = '';
    if ($newtopic) {
        $res = mysql_query("SELECT name FROM forums WHERE id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or die("Bad forum ID!");
        $htmlout .= "<h3>New topic in <a href='" . $_SERVER['PHP_SELF'] . "?action=viewforum&amp;forumid=" . $id . "'>" . htmlspecialchars($arr["name"]) . "</a> forum</h3>";
    } else {
        $res = mysql_query("SELECT subject, locked FROM topics WHERE id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or die("Forum error, Topic not found.");
        if ($arr['locked'] == 'yes') {
            stderr("Sorry", "The topic is locked.");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            print stdhead("Compose") . $htmlout . stdfoot();
            exit;
        }
        $htmlout .= "<h3 align='center'>Reply to topic: <a href='" . $_SERVER['PHP_SELF'] . "action=viewtopic&amp;topicid=" . $id . "'>" . htmlspecialchars($arr["subject"]) . "</a></h3>";
    }
    $htmlout .= "\r\n    <script  type='text/javascript'>\r\n    /*<![CDATA[*/\r\n    function Preview()\r\n    {\r\n    document.compose.action = './preview.php'\r\n    document.compose.target = '_blank';\r\n    document.compose.submit();\r\n    return true;\r\n    }\r\n    /*]]>*/\r\n    </script>";
    $htmlout .= begin_frame("Compose", true);
    $htmlout .= "<form method='post' name='compose' action='" . $_SERVER['PHP_SELF'] . "' enctype='multipart/form-data'>\r\n\t  <input type='hidden' name='action' value='post' />\r\n\t  <input type='hidden' name='" . ($newtopic ? 'forumid' : 'topicid') . "' value='" . $id . "' />";
    $htmlout .= begin_table(true);
    if ($newtopic) {
        $htmlout .= "<tr>\r\n\t\t\t<td class='rowhead' width='10%'>Subject</td>\r\n\t\t\t<td align='left'>\r\n\t\t\t\t<input type='text' size='100' maxlength='" . $maxsubjectlength . "' name='subject' style='height: 19px' />\r\n\t\t\t</td>\r\n\t\t</tr>";
    }
    if ($quote) {
        $postid = (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            stderr("Error", "Invalid ID!");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            print stdhead("Compose") . $htmlout . stdfoot();
            exit;
        }
        $res = mysql_query("SELECT posts.*, users.username FROM posts JOIN users ON posts.userid = users.id WHERE posts.id = {$postid}") or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($res) == 0) {
            stderr("Error", "No post with this ID");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            print stdhead("Error - No post with this ID") . $htmlout . stdfoot();
            exit;
        }
        $arr = mysql_fetch_assoc($res);
    }
    $htmlout .= "<tr>\r\n\t\t<td class='rowhead' width='10%'>Body</td>\r\n\t\t<td>";
    $qbody = $quote ? "[quote=" . htmlspecialchars($arr["username"]) . "]" . htmlspecialchars(unesc($arr["body"])) . "[/quote]" : "";
    if (function_exists('textbbcode')) {
        $htmlout .= textbbcode("compose", "body", $qbody);
    } else {
        $htmlout .= "<textarea name='body' style='width:99%' rows='7'>{$qbody}</textarea>";
    }
    $htmlout .= "</td></tr>";
    if ($use_attachment_mod && $attachment) {
        $htmlout .= "<tr>\r\n\t\t\t\t<td colspan='2'><fieldset class='fieldset'><legend>Add Attachment</legend>\r\n\t\t\t\t<input type='checkbox' name='uploadattachment' value='yes' />\r\n\t\t\t\t<input type='file' name='file' size='60' />\r\n        <div class='error'>Allowed Files: rar, zip<br />Size Limit " . mksize($maxfilesize) . "</div></fieldset>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>";
    }
    $htmlout .= "<tr>\r\n   \t  <td align='center' colspan='2'>" . post_icons() . "</td>\r\n \t    </tr><tr>\r\n \t\t  <td colspan='2' align='center'>\r\n \t    <input type='submit' value='Submit' /><input type='button' value='Preview' name='button2' onclick='return Preview();' />\n";
    if ($newtopic) {
        $htmlout .= "Anonymous Topic<input type='checkbox' name='anonymous' value='yes'/>\n";
    } else {
        $htmlout .= "Anonymous Post<input type='checkbox' name='anonymous' value='yes'/>\n";
    }
    $htmlout .= "</td></tr>\n";
    $htmlout .= end_table();
    $htmlout .= "</form>";
    $htmlout .= end_frame();
    // ------ Get 10 last posts if this is a reply
    if (!$newtopic) {
        $postres = mysql_query("SELECT p.id, p.added, p.body, p.anonymous, u.id AS uid, u.username, u.avatar, u.offavatar " . "FROM posts AS p " . "LEFT JOIN users AS u ON u.id = p.userid " . "WHERE p.topicid = " . sqlesc($id) . " " . "ORDER BY p.id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($postres) > 0) {
            $htmlout .= "<br />";
            $htmlout .= begin_frame("10 last posts, in reverse order");
            while ($post = mysql_fetch_assoc($postres)) {
                $avatar = $CURUSER["avatars"] == "all" ? htmlspecialchars($post["avatar"]) : ($CURUSER["avatars"] == "some" && $post["offavatar"] == "no" ? htmlspecialchars($post["avatar"]) : "");
                if ($post['anonymous'] == 'yes') {
                    $avatar = $TBDEV['pic_base_url'] . $forum_pics['default_avatar'];
                } else {
                    $avatar = $CURUSER["avatars"] == "yes" ? htmlspecialchars($post["avatar"]) : '';
                }
                if (empty($avatar)) {
                    $avatar = $TBDEV['pic_base_url'] . $forum_pics['default_avatar'];
                }
                if ($post["anonymous"] == "yes") {
                    if ($CURUSER['class'] < UC_MODERATOR && $post["uid"] != $CURUSER["id"]) {
                        $htmlout .= "<p class='sub'>#" . $post["id"] . " by <i>Anonymous</i> at " . get_date($post["added"], 'LONG', 1, 0) . "</p>";
                    } else {
                        $htmlout .= "<p class='sub'>#" . $post["id"] . " by <i>Anonymous</i> (<b>" . $post["username"] . "</b>) at " . get_date($post["added"], 'LONG', 1, 0) . "</p>";
                    }
                } else {
                    $htmlout .= "<p class='sub'>#" . $post["id"] . " by " . (!empty($post["username"]) ? $post["username"] : "******") . " at " . get_date($post["added"], 'LONG', 1, 0) . "</p>";
                }
                $htmlout .= begin_table(true);
                $htmlout .= "<tr>\r\n\t\t\t\t\t\t<td height='100' width='100' align='center' style='padding: 0px' valign='top'><img height='100' width='100' src='" . $avatar . "' alt='User avvy' /></td>\r\n\t\t\t\t\t\t<td class='comment' valign='top'>" . format_comment($post["body"]) . "</td>\r\n\t\t\t\t\t</tr>";
                $htmlout .= end_table();
            }
            $htmlout .= end_frame();
        }
    }
    $htmlout .= insert_quick_jump_menu();
    return $htmlout;
}
Пример #10
0
function insert_compose_frame($id, $newtopic = true, $quote = false)
{
    global $maxsubjectlength, $CURUSER, $forum_pic_url;
    if ($newtopic) {
        $res = mysql_query("SELECT name FROM forums WHERE id={$id}") or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or die("Bad forum id");
        $forumname = $arr["name"];
        print "<p align=center>New topic in <a href=?action=viewforum&forumid={$id}>{$forumname}</a> forum</p>\n";
    } else {
        $res = mysql_query("SELECT * FROM topics WHERE id={$id}") or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or stderr("Forum error", "Topic not found.");
        $subject = htmlentities($arr["subject"], ENT_QUOTES);
        print "<p align=center>Reply to topic: <a href=?action=viewtopic&topicid={$id}>{$subject}</a></p>";
    }
    begin_frame("Compose", true);
    print "<form method=post action=forums.php?action=post>\n";
    if ($newtopic) {
        print "<input type=hidden name=forumid value={$id}>\n";
    } else {
        print "<input type=hidden name=topicid value={$id}>\n";
    }
    begin_table();
    if ($newtopic) {
        print "<tr><td class=rowhead>Subject</td>" . "<td align=left style='padding: 0px'><input type=text size=100 maxlength={$maxsubjectlength} name=subject " . "style='border: 0px; height: 19px'></td></tr>\n";
    }
    if ($quote) {
        $postid = (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            header("Location: {$BASEURL}/forums.php");
        }
        $res = mysql_query("SELECT posts.*, users.username FROM posts LEFT JOIN users ON posts.userid = users.id WHERE posts.id={$postid}") or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($res) != 1) {
            stderr("Error", "No post with ID.");
        }
        $arr = mysql_fetch_assoc($res);
    }
    print "<tr><td class=rowhead>Body</td><td align=left style='padding: 0px'>" . "<textarea name=body cols=100 rows=20 style='border: 0px'>" . ($quote ? "[quote=" . htmlspecialchars($arr["username"]) . "]" . htmlspecialchars($arr["body"]) . "[/quote]" : "") . "</textarea></td></tr>\n";
    print "<tr><td colspan=2 align=center><input type=submit class=btn value='Submit'></td></tr>\n";
    end_table();
    print "</form>\n";
    print "<p align=center><a href=tags.php target=_blank>Tags</a> | <a href=smilies.php target=_blank>Smilies</a></p>\n";
    end_frame();
    //------ Get 10 last posts if this is a reply
    if (!$newtopic) {
        $postres = mysql_query("SELECT * FROM posts WHERE topicid={$id} ORDER BY id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        begin_frame("10 last posts, in reverse order");
        while ($post = mysql_fetch_assoc($postres)) {
            //-- Get poster details
            $userres = mysql_query("SELECT * FROM users WHERE id=" . $post["userid"] . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
            $user = mysql_fetch_assoc($userres);
            if ($CURUSER["avatars"] == "yes") {
                $avatar = $user['avatar'] ? "<img width={$user['av_w']} height={$user['av_h']} src='" . htmlentities($user['avatar'], ENT_QUOTES) . "' />" : "<img width=100 src='{$forum_pic_url}default_avatar.gif' />";
            } else {
                $avatar = "<img width=100 src='{$forum_pic_url}default_avatar.gif' />";
            }
            print "<p class=sub>#" . $post["id"] . " by " . $user["username"] . " on " . get_date($post['added'], '');
            begin_table(true);
            print "<tr valign=top><td width=150 align=center style='padding: 0px'>" . ($avatar ? $avatar : "") . "</td><td class=comment>" . format_comment($post["body"]) . "</td></tr>\n";
            end_table();
        }
        end_frame();
    }
    insert_quick_jump_menu();
}
Пример #11
0
function insert_compose_frame($id, $newtopic = true, $quote = false)
{
    global $maxsubjectlength, $CURUSER, $lang, $forum_pic_url;
    $htmlout = '';
    if ($newtopic) {
        $res = mysql_query("SELECT name FROM forums WHERE id={$id}") or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or die("{$lang['forum_functions_badid']}");
        $forumname = $arr["name"];
        $htmlout .= "<p style='text-align:center;'>{$lang['forum_functions_newtopic']}<a href='forums.php?action=viewforum&amp;forumid={$id}'>{$forumname}</a>{$lang['forum_functions_forum']}</p>\n";
    } else {
        $res = mysql_query("SELECT * FROM topics WHERE id={$id}") or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_assoc($res) or stderr("{$lang['forum_functions_error']}", "{$lang['forum_functions_topic']}");
        $subject = htmlentities($arr["subject"], ENT_QUOTES);
        $htmlout .= "<p style='text-align:center;'>{$lang['forum_functions_reply']}<a href='forums.php?action=viewtopic&amp;topicid={$id}'>{$subject}</a></p>";
    }
    $htmlout .= begin_frame("Compose", true);
    $htmlout .= "<form method='post' action='forums.php?action=post'>\n";
    if ($newtopic) {
        $htmlout .= "<input type='hidden' name='forumid' value='{$id}' />\n";
    } else {
        $htmlout .= "<input type='hidden' name='topicid' value='{$id}' />\n";
    }
    $htmlout .= begin_table();
    if ($newtopic) {
        $htmlout .= "<tr><td class='rowhead'>{$lang['forum_functions_subject']}</td>" . "<td align='left' style='padding: 0px'><input type='text' size='100' maxlength='{$maxsubjectlength}' name='subject' " . "style='border: 0px; height: 19px' /></td></tr>\n";
    }
    if ($quote) {
        $postid = (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            header("Location: {$TBDEV['baseurl']}/forums.php");
        }
        $res = mysql_query("SELECT posts.*, users.username FROM posts LEFT JOIN users ON posts.userid = users.id WHERE posts.id={$postid}") or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($res) != 1) {
            stderr("{$lang['forum_functions_error']}", "{$lang['forum_functions_nopost']}");
        }
        $arr = mysql_fetch_assoc($res);
    }
    $htmlout .= "<tr><td class='rowhead'>{$lang['forum_functions_body']}</td><td align='left' style='padding: 0px'>" . "<textarea name='body' cols='100' rows='20' style='border: 0px'>" . ($quote ? "[quote=" . htmlspecialchars($arr["username"]) . "]" . htmlspecialchars($arr["body"]) . "[/quote]\n" : "") . "</textarea></td></tr>\n";
    $htmlout .= "<tr><td colspan='2' align='center'><input type='submit' class='btn' value='{$lang['forum_functions_submit']}' /></td></tr>\n";
    $htmlout .= end_table();
    $htmlout .= "</form>\n";
    $htmlout .= "<p style='text-align:center;'><a href='tags.php' target='_blank'>{$lang['forum_functions_tags']}</a> | <a href='smilies.php' target='_blank'>{$lang['forum_functions_smilies']}</a></p>\n";
    $htmlout .= end_frame();
    //------ Get 10 last posts if this is a reply
    if (!$newtopic) {
        $postres = mysql_query("SELECT * FROM posts WHERE topicid={$id} ORDER BY id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        $htmlout .= begin_frame("{$lang['forum_functions_last10']}");
        while ($post = mysql_fetch_assoc($postres)) {
            //-- Get poster details
            $userres = mysql_query("SELECT * FROM users WHERE id=" . $post["userid"] . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
            $user = mysql_fetch_assoc($userres);
            if ($CURUSER["avatars"] == "yes") {
                $avatar = $user['avatar'] ? "<img width='{$user['av_w']}' height='{$user['av_h']}' src='" . htmlentities($user['avatar'], ENT_QUOTES) . "' alt='' />" : "<img width='100' src='{$forum_pic_url}default_avatar.gif' alt='default' />";
            } else {
                $avatar = "<img width='100' src='{$forum_pic_url}default_avatar.gif' alt='' />";
            }
            $htmlout .= "<p class='sub'>#" . $post["id"] . " by " . $user["username"] . " on " . get_date($post['added'], '') . "</p>";
            $htmlout .= begin_table(true);
            $htmlout .= "<tr valign='top'><td width='150' align='center' style='padding: 0px'>" . ($avatar ? $avatar : "") . "</td><td class='comment'>" . format_comment($post["body"]) . "</td></tr>\n";
            $htmlout .= end_table();
        }
        $htmlout .= end_frame();
    }
    $htmlout .= insert_quick_jump_menu();
    return $htmlout;
}
Пример #12
0
  function insert_compose_frame($id, $newtopic = true, $quote = false)
  {
    global $maxsubjectlength, $CURUSER;

    if ($newtopic)
    {
      $res = mysql_query("SELECT name FROM forums WHERE id=$id") or sqlerr(__FILE__, __LINE__);

      $arr = mysql_fetch_assoc($res) or die("Slæmt spjallborðs id");

      $forumname = $arr["name"];

      print("<p align=center>Nýr þráður á <a href=?action=viewforum&forumid=$id>$forumname</a> spjallborðinu</p>\n");
    }
    else
    {
      $res = mysql_query("SELECT * FROM topics WHERE id=$id") or sqlerr(__FILE__, __LINE__);

      $arr = mysql_fetch_assoc($res) or stderr("Villa", "Þráður fanst ekki.");

      $subject = $arr["subject"];

      print("<p align=center>Svara þræði: <a href=?action=viewtopic&topicid=$id>$subject</a></p>");
    }

    begin_frame("Skrifa", true);

	// Start if command for double-post protection
	if($newtopic || get_owner_of_last_post() !== $CURUSER['id']) {

    print("<form method=post action=?action=post>\n");

    if ($newtopic)
      print("<input type=hidden name=forumid value=$id>\n");

    else
      print("<input type=hidden name=topicid value=$id>\n");

    begin_table();

    if ($newtopic)
      print("<tr><td class=rowhead>Umræðuefni</td>" .
        "<td align=left style='padding: 0px'><input type=text size=100 maxlength=$maxsubjectlength name=subject " .
        "style='border: 0px; height: 19px'></td></tr>\n");

    if ($quote)
    {
       $postid = $_GET["postid"];
       if (!is_valid_id($postid))
         die;

	   $res = mysql_query("SELECT posts.*, users.username FROM posts JOIN users ON posts.userid = users.id WHERE posts.id=$postid") or sqlerr(__FILE__, __LINE__);

	   if (mysql_num_rows($res) != 1)
	     stderr("Villa", "Ekkert svar með ID $postid.");

	   $arr = mysql_fetch_assoc($res);
    }

    print("<tr><td class=rowhead>Meginatriði</td><td align=left style='padding: 0px'>" .
    "<textarea name=body cols=100 rows=20 style='border: 0px'>".
    ($quote?(("[quote=".htmlspecialchars($arr["username"])."]".htmlspecialchars($arr["body"])."[/quote]")):"").
    "</textarea></td></tr>\n");

    print("<tr><td colspan=2 align=center><input type=submit class=btn value='Senda'></td></tr>\n");

    end_table();

    print("</form>\n");

		print("<p align=center><a href=tags.php target=_blank>Skipanir</a> | <a href=smilies.php target=_blank>Broskallar</a></p>\n");

	} else // End if command for double-post protection
		echo 'Vinsamlegast notaðu möguleikann "Breyta" í staðinn fyrir að senda tvisvar í röð á sama þráðinn!';
    end_frame();

    //------ Get 10 last posts if this is a reply

    if (!$newtopic)
    {
      $postres = mysql_query("SELECT * FROM posts WHERE topicid=$id ORDER BY id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);

      begin_frame("10 nýjustur þræðir, í öfugri röð");

      while ($post = mysql_fetch_assoc($postres))
      {
        //-- Get poster details

        $userres = mysql_query("SELECT * FROM users WHERE id=" . $post["userid"] . " LIMIT 1") or sqlerr(__FILE__, __LINE__);

        $user = mysql_fetch_assoc($userres);

      	$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($user["avatar"]) : "");
//	    $avatar = $user["avatar"];

        if (!$avatar)
          $avatar = "/pic/default_avatar.gif";
	if ($CURUSER["hideadult"] === 'yes' && $USER["avadult"] === 'yes')
	  $avatar = "/ismod/disable_18.jpg";
	  
        print("<p class=sub>#" . $post["id"] . " eftir " . $user["username"] . " at " . $post["added"] . " GMT</p>");

        begin_table(true);

         echo '<tr valign="top"><td width="150px" align="center" style="padding: 0px">' . ($avatar ? "<img width=150 src=$avatar>" : "");
	if($CURUSER['class'] >= UC_MODERATOR && $arr2['avadult'] === 'yes')
		echo '<br />[Merkt sem særandi]';
	elseif($CURUSER['class'] >= UC_MODERATOR && $arr2['avadult'] === 'no')
		echo '<br />[Merkt sem viðeigandi]';
	if($user['class'] >= UC_MODERATOR)
		echo '<br /><img src="/pic/stjornandi.png" />';
         echo '</td><td class="comment">' . format_comment($post["body"]); 
	echo '</td></tr>'."\n";

        end_table();

      }

      end_frame();

    }

  insert_quick_jump_menu();

  }