Exemple #1
0
        print "comments";
    } else {
        print "comment";
    }
    echo '<a href="#" id="ci" onclick="showHideIgnored(' . $id . ',\'ci\'); return false;"> (0 hidden)</a><br />';
    //List comments... Could this be better off as a function to use here and on the comment list page? :S
    $query = "SELECT SQL_NO_CACHE id, comment, user, posted_at, score, spam FROM {$comment_table} WHERE post_id='{$id}' ORDER BY posted_at ASC LIMIT {$page}, {$limit}";
    $result = $db->query($query);
    $ccount = 0;
    while ($row = $result->fetch_assoc()) {
        echo '<div id="c' . $row['id'] . '" style="display:inline;"><br /><a href="index.php?page=account_profile&amp;uname=' . $row['user'] . '">' . $row['user'] . '</a><br /><b>Posted on ' . date('Y-m-d H:i:s', $row['posted_at']) . ' Score: <a id="sc' . $row['id'] . '">' . $row['score'] . '</a> (vote <a href="#" onclick="Javascript:vote(\'' . $id . '\', \'' . $row['id'] . '\', \'up\'); return false;">Up</a>/<a href="#" onclick="Javascript:vote(\'' . $id . '\', \'' . $row['id'] . '\', \'down\'); return false;">Down</a>)&nbsp;&nbsp;&nbsp;';
        ?>
			(<?php 
        $row['spam'] == false ? print "<a id=\"rc" . $row['id'] . "\"></a><a href=\"#\" id=\"rcl" . $row['id'] . "\" onclick=\"Javascript:spam('comment','" . $row['id'] . "')\">Report as spam</a>)" : (print "<b>Reported</b>)");
        $got_permission == true ? print ' (<a href="#" onclick="document.location=\'public/remove.php?id=' . $row['id'] . '&removecomment=1&post_id=' . $id . '\'; return false;">Remove</a>)' : (print '');
        print "</b><br />" . $misc->swap_bbs_tags($misc->short_url($misc->linebreaks($row['comment'])));
        ?>
<br /></div>
			<script type="text/javascript">
			//<![CDATA[
			posts[<?php 
        echo $id;
        ?>
].comments[<?php 
        echo $row['id'];
        ?>
] = {'score':<?php 
        echo $row['score'];
        ?>
, 'user':'******'\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $row['user'])));
Exemple #2
0
                exit;
            }
            $cache = new cache();
            @$cache->destroy_page_cache("cache/" . $id);
            @$cache->create_page_cache("cache/" . $id);
            $comment->vote($cid, $vote, $user, $id, $user_id);
        } else {
            if (isset($_GET['s']) && $_GET['s'] === "view" && isset($_GET['cid']) && is_numeric($_GET['cid'])) {
                header("Cache-Control: store, cache");
                header("Pragma: cache");
                require "includes/header.php";
                $cid = $db->real_escape_string($_GET['cid']);
                $query = "SELECT post_id, comment, user, posted_at, score FROM {$comment_table} WHERE id='{$cid}'";
                $result = $db->query($query);
                $row = $result->fetch_assoc();
                echo '<a href="index.php?page=post&s=view&id=' . $row['post_id'] . '">' . $row['post_id'] . '</a> ' . $misc->swap_bbs_tags($misc->linebreaks($misc->short_url(htmlentities($row['comment'], ENT_QUOTES, "UTF-8")))) . ' ' . $row['user'] . ' ' . $row['posted_at'] . ' ' . $row['score'];
                $result->free_result();
            }
        }
    }
} else {
    if (isset($_GET['s']) && $_GET['s'] == "list") {
        //number of comments/page
        $limit = 15;
        //number of pages to display. number - 1. ex: for 5 value should be 4
        $page_limit = 4;
        header("Cache-Control: store, cache");
        header("Pragma: cache");
        $cache = new cache();
        $domain = $cache->select_domain();
        require "includes/header.php";
    header("Location: index.php?page=forum&s=list");
    exit;
}
$pg = "forum2";
require "includes/header.php";
$query = "SELECT t1.id, t1.title, t1.post, t1.author, t1.creation_date, t2.creation_post FROM {$forum_post_table}  AS t1 JOIN {$forum_topic_table} AS t2 ON t2.id=t1.topic_id WHERE t1.topic_id='{$id}' ORDER BY id LIMIT {$page}, {$limit}";
$result = $db->query($query) or die(mysql_error());
print '<div style="margin-left: 15px; margin-right: 15px;"><div id="forum" class="response-list">';
while ($row = $result->fetch_assoc()) {
    $date_made = $misc->date_words($row['creation_date']);
    print '<div class="post"><div class="author">
		<h6 class="author"><a name="' . $row['id'] . '"></a><a href="index.php?page=account_profile&amp;uname=' . $row['author'] . '" style="font-size: 14px;">' . $row['author'] . '</a></h6>
		<span class="date">' . $date_made . ' </span>
		</div><div class="content">
		<h6 class="response-title">' . $row['title'] . '</h6>
		<div class="body">' . $misc->short_url($misc->swap_bbs_tags($misc->linebreaks($row['post']))) . '</div>
		<div class="footer">';
    if ($uname == $row['author'] || $user->gotpermission('edit_forum_posts')) {
        echo '<a href="#" onclick="showHide(\'c' . $row['id'] . '\'); return false;">edit</a> |';
    } else {
        echo '<a href="">edit</a> |';
    }
    echo ' <a href="#" onclick="javascript:document.getElementById(\'reply_box\').value=document.getElementById(\'reply_box\').value+\'[quote]' . $row['author'] . ' said:\\r\\n' . str_replace("'", "\\'", str_replace("\r\n", '\\r\\n', str_replace('&#039;', "'", $row['post']))) . '[/quote]\'; return false;">quote</a> ';
    if ($user->gotpermission('delete_forum_posts') && $row['id'] != $row['creation_post']) {
        print ' | <a href="index.php?page=forum&amp;s=remove&amp;pid=' . $id . '&amp;cid=' . $row['id'] . '">remove</a><br />';
    }
    if ($uname == $row['author'] || $user->gotpermission('edit_forum_posts')) {
        print '<form method="post" action="index.php?page=forum&amp;s=edit&amp;pid=' . $id . '&amp;cid=' . $row['id'] . '&amp;ppid=' . $page . '" style="display:none" id="c' . $row['id'] . '"><table><tr><td><input type="text" name="title" value="' . $row['title'] . '"/></td></tr><tr><td><textarea name="post" rows="4" cols="6" style="width: 450px; height: 150px;">' . $row['post'] . '</textarea></td></tr><tr><td><input type="submit" name="submit" value="Edit"/></td></tr></table></form>';
    }
    echo '</div></div></div>';
}
Exemple #4
0
				//]]>
				</script>';
                if ($img != "") {
                    $images .= '<script type="text/javascript">
					//<![CDATA[
					posts.totalcount[' . $lastpid . '] = \'' . $ptcount . '\'
					//]]>
					</script>';
                }
                $ptcount = 0;
                $images .= '<div class="col1"><a href="index.php?page=post&amp;s=view&amp;id=' . $row['post_id'] . '"><img src="' . $thumbnail_url . '/' . $row['dir'] . '/thumbnail_' . $row['image'] . '" border="0" class="preview" title="' . $tags . '" alt="thumbnail"/></a></div><div class="col2">';
                $img = $row['image'];
            }
            $images .= '<div class="comment" id="c' . $row['id'] . '"><h4><a href="index.php?page=account_profile&amp;uname=' . $row['user'] . '">' . $row['user'] . '</a></h4><h6 class="comment-header">Posted on ' . $posted_at . '  (';
            $row['spam'] == false ? $images .= '<a id="rc' . $row['id'] . '"></a><a href="#" id="rcl' . $row['id'] . '" onclick="Javascript:spam(\'comment\',\'' . $row['id'] . '\')">Flag for deletion</a>)</h6>' : ($images .= "<b>Already flagged</b>)</h6>");
            $images .= "<div id=\"cbody" . $row['id'] . "\"><p>" . $misc->swap_bbs_tags($misc->short_url($misc->linebreaks($row['comment']))) . "</p></div></div>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t//<![CDATA[\n\t\t\tposts.comments[" . $row['id'] . "] = {'score':" . $row['score'] . ", 'user':'******'\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $row['user']))) . "', 'post_id':'" . $row['post_id'] . "'}\n\t\t\t//]]>\n\t\t\t</script>";
            ++$ccount;
            ++$ptcount;
            ++$tcount;
            $lastpid = $row['post_id'];
        }
        $ttags = explode(" ", $tags);
        $images .= '</div><div class="col3"><ul class="post-info">';
        $images .= "<li>{$pat}</li><li>rating:{$rating}</li><li>user:"******"</li>";
        $ttcount = 0;
        foreach ($ttags as $current) {
            if ($ttcount < 15) {
                $images .= "<li><a href=\"index.php?page=post&amp;s=list&amp;tags={$current}\">{$current}</a></li>";
                ++$ttcount;
            }
        }