Location: PHPKode > scripts > WH Social > wh_social/read_discussion.php
<?php require('framework/session.php'); ?>
<?php require('framework/ready.php'); ?>
<?php require('style/layout/header.php'); ?>

<div id="content_wrapper">
    <div class="content">

    <?php

        echo '<div class="content_left">
        <div id="breadcrumb">
            <ul class="crumbs">
                <li class="first"><a href="index.php" style="z-index:9;"><span></span>' . $lang['index'] . '</a></li>
                <li><a href="discussions.php" style="z-index:8;">' . $lang['discussions'] . '</a></li>
                <li><a href="read_discussion.php?id=' . intval($_GET['id']) . '" style="z-index:7;">' . $lang['read_disc'] . '</a></li>
            </ul>
        </div>
        </div>

        <div class="content_right">';

            include('modules/search.inc.php');
        echo '</div>

        <div class="clear_long"></div>';

        $ret = 1;

        echo '<div class="main_menu">';

            $ret = include 'framework/templates/'.$main_content['menu'];
        echo '<div id="line"></div>';

            $ret = include 'framework/templates/'.$main_content['infos'];
        echo '</div>';

        echo '<div class="main_content">';

        if((isset($_GET['id'])) && (is_numeric($_GET['id']))) {

		$id = mysql_real_escape_string($_GET['id']);
		$id = intval($_GET['id']);

			}else{

			echo '<p class="false">' . $lang['invalid_id'] . '</p>';
			exit();
			}

		$sql = "SELECT * FROM topics WHERE id = " . $id;

		$result = mysql_query($sql) OR die(mysql_error());

		if(!$result) {

		echo '<p class="false">' . $lang['no_discussion'] . '</p>' . mysql_error();

			}else{

			if(intval(mysql_num_rows($result)) == 0) {

			echo '<p class="false">' . $lang['no_discussion'] . '</p>' . mysql_error();

		}else{

		while($row = mysql_fetch_assoc($result)) {

    		$viewsql = "UPDATE
    						topics
    					SET
    						views = views + 1
    					WHERE
    						id = " . $id;

    		$viewcount = mysql_query($viewsql) OR die(mysql_error());

        $path  = $_SERVER["PHP_SELF"];
        $query = mysql_query("SELECT topic FROM discussions WHERE topic = '" . $id . "'");
        $total = mysql_num_rows($query);
        $allsites = ceil($total / $entries);

        include('framework/functions/selection.php');

		$sql = "SELECT
				    discussions.topic,
				    discussions.content,
				    discussions.date AS postDATE,
				    discussions.author,
				    members.id AS memID,
				    members.name,
				    members.date,
				    members.level,
				    members.avatar,
				    profiles.id,
				    profiles.signature
			    FROM
				    discussions
			    LEFT JOIN
				    members
			    ON
				    discussions.author = members.id
			    LEFT JOIN
				    profiles
			    ON
				    profiles.id = members.id
			    WHERE
				    discussions.topic = '" . $id . "'
			    LIMIT
                    $start,$entries";

		$result = mysql_query($sql) OR die(mysql_error());

		if(!$result) {

		echo '<p class="false">' . $lang['no_discussion'] . '</p>';

		}else{

        echo '<h1 class="p_space">' . htmlentities($row['subject'], ENT_QUOTES) . '</h1>';

		while($row = mysql_fetch_assoc($result)) {

            include_once('framework/filter.php');
            include_once('framework/functions/badwords.php');
            include_once('framework/functions/smileys.php');

            echo '<ul id="conversationPosts" class="postList">
            <li>
            <div class="post hasControls">
            <div class="avatar"><a href="member.php?id=' . (int)$row['memID'] . '"><img src="' . htmlentities($row['avatar']) . '" class="Avatar" border="0" alt="Avatar"></a></div>
            <div class="postContent thing">
            <div class="postHeader">
            <div class="info">
            <a href="member.php?id=' . (int)$row['memID'] . '">' . htmlentities($row['name'], ENT_QUOTES) . '</a>&nbsp;&nbsp;&nbsp;<small>' . date('d.m.Y - H:i', strtotime($row['postDATE'])) . ' ' . $lang['o_clock'] . '</small>
            </div>
            <div class="controls"></div>
            </div>
            <div class="postBody">
            <p>' . mysql_filter(filter_html(badwords(smileys(stripslashes(nl2br($row['content'])))))) . '</p>
            </div>
            </div>
            </div></li>
            </ul>';

            echo '<span class="postSignature"><small>';

            if($row['signature']) { echo '<span class="small_signature">' . stripslashes(strip_tags($row['signature'])) . '</span>'; }elseif($row['signature']== "") { echo ''; }

            echo '</small></span>
            <span class="postIcons"><a href="framework/feeds/rss.php" target="_blank"><img src="style/buttons/rss.png" alt="Feeds" hspace="3" border="0"></a>
            <a href="read_discussion.php?id=' . $id . '#top"><img src="style/buttons/top.png" alt="Top" border="0"></a></span>';

            echo '<div class="spacer"></div>';
    		}

        echo '<div id="navigation">
        <span class="pages">Seite ' . $page . ' von ' . $allsites . '</span>';
        echo $link_string;
        echo '</div>
        <div class="clear_navi"></div>';

        mysql_free_result($result);
		}

		include_once('framework/functions/captcha.php');

        echo '<a name="reply" id="reply"></a><form name="topic" method="post" action="reply.php?id=' . $id . '">
        <p><h3>' . $lang['reply'] . '</h3>
        <textarea cols="45" rows="8" name="reply" id="reply" class="textareas"></textarea></p>
        <p><small>Captcha *</small><br>
        ' . $lang['the_sum_of'] . ' ' . $random1 . ' + ' . $code . ' = <input size="5" name="zip" id="Spamschutz" type="text" class="captchas"><input type="hidden" name="zip2" value=' . $rand_result . '></p>
        <p><input type="submit" name="submit" value="' . $lang['reply'] . '" alt="' . $lang['reply'] . '" class="buttons"></p>
        <input type="hidden" name="submitted" value="TRUE">
        </form>';

        }}}

	?>

<?php require('style/layout/footer.php'); ?>
Return current item: WH Social