[S] ReCMS ADDON pack [S]

  • Hier die .php!

    [hide]<?php

    require_once('./data_classes/server-data.php_data_classes-core.php.php');
    require_once('./data_classes/server-data.php_data_classes-session.php.php');

    $body_id = "news";
    $pageid = "11";

    $news_id = FilterText($_GET['web-articles-id']);
    $main_sql = mysql_query("SELECT * FROM cms_news WHERE id = '".$news_id."'") or die(mysql_error());
    $article_exists = mysql_num_rows($main_sql);

    if($article_exists == "1"){
    $news = mysql_fetch_assoc($main_sql);
    $pagename = "News - ".HoloText($news['title'])."";
    } else {
    $main_sql = mysql_query("SELECT * FROM cms_news ORDER BY ID DESC") or die(mysql_error());
    $news = mysql_fetch_assoc($main_sql);
    $news_id = $news['id'];
    $pagename = "News - ".HoloText($news['title'])."";
    }
    if(isset($_GET['vote']) || FilterText($_GET['vote']) == "like" || FilterText($_GET['vote']) == "unlike"){
    $vote = FilterText($_GET['vote']);

    $usercheck = mysql_query("SELECT id_user FROM cms_news_vote WHERE id_user = '".$my_id."' AND id_news = '".$news_id."'") or die(mysql_error());
    if(mysql_num_rows($usercheck) < 1){

    if($vote == "like"){
    mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','1','0')") or die(mysql_error());
    } else {
    mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','0','1')") or die(mysql_error());
    }

    header("location: $path/articles/".$news_id."");
    } else {
    $msg = "<script>alert(\"Du hast bereits bei diesen News gevotet!\");</script>";
    }
    }

    require_once('./templates/community_subheader.php');
    require_once('./templates/community_header.php');

    ?>

    <link rel="stylesheet" href="<?php echo $path; ?>web-gallery/static/styles/news.css" type="text/css" />


    <div id="container">
    <div id="content">
    <div id="column1" class="column">
    <div class="habblet-container ">
    <div class="cbb clearfix blue">
    <h2 class="title">News</h2>
    <div id="article-archive">

    <?php

    $sql = mysql_query("SELECT * FROM cms_news ORDER BY id DESC");
    if(mysql_num_rows($sql) > 0){

    ?>
    <h2>Letzten News</h2>
    <ul>


    <?php while($row = mysql_fetch_assoc($sql)){ ?>

    <li><?php if($news_id !== $row['id']){ echo"<a href=\"".$path."/articles/".$row['id']."\">"; } ?>
    <?php echo $row['title']; ?></a> &raquo;
    <?php if($news_id !== $row['id']){ echo"</a>"; } ?></li>

    <?php } ?>

    </ul>

    <?php } ?>

    <h2>Mehr News?</h2>
    <ul>
    <li>
    <a href="<?php echo $path; ?>/articles" class="article">Alle News anzeigen</a> &raquo;
    </li>
    </ul>
    </div>

    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
    </div>

    <div id="column2" class="column">
    <div class="habblet-container ">
    <div class="cbb clearfix notitle ">

    <div id="article-wrapper">
    <h2><?php echo HoloText($news['title']); ?></h2>
    <div class="article-meta">Geschrieben am <?php echo date('d.m.Y', $news['published']); ?></div>
    <p class="summary"><?php echo nl2br($news['longstory']); ?></p>
    <div class="article-body">
    <?php echo $news['shortstory']; ?>
    <div class="article-body"><img src="../web-gallery/album1/users_online.PNG"> <b><?php echo $news['author']; ?></b><br><br></div>
    <li><div style="float: right"><?php if(mysql_num_rows($usercheck = mysql_query("SELECT id_user FROM cms_news_vote WHERE id_user = '".$my_id."' AND id_news = '".$news_id."'")) < 1){ ?><a href="./articles/<?php echo $news_id; ?>&vote=like"><img src=".\web-gallery\v2\images\like.png"></a> <a href="./articles/<?php echo $news_id; ?>&vote=unlike"><img src=".\web-gallery\v2\images\unlike.png"></a><?php } ?></div>

    <?php
    $votecheck = mysql_query("SELECT * FROM cms_news_vote WHERE id_news = '".$news_id."'");
    $votecount = mysql_num_rows($votecheck);
    if($votecount < 1){
    $percentlike = "50";
    $percentunlike = "50";
    $like = "0";
    $unlike = "0";
    } else {
    $percentlike = 100 / $votecount * mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_like = '1'");
    $percentunlike = 100 / $votecount * mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_unlike = '1'");
    $like = mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_like = '1'");
    $unlike = mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_unlike = '1'");
    }
    ?>
    <div class="watch-sparkbars">
    <div class="watch-sparkbar-likes" style="http://www4.yooco.de/uploads/s4/images/website/2193964/image/ADM_1.gif\"></div>
    <div class="watch-sparkbar-dislikes" style="width: <?php echo $percentunlike ?>%"></div>
    </div>
    <span class="watch-likes-dislikes">
    Gefällt <span class="likes"><?php echo $like; ?></span>, gefällt <span class="dislikes"><?php echo $unlike; ?></span> nicht
    </span>

    </li>
    </div></div></div></div>
    <?php if(!empty($facebook)){ ?>
    <br><br>
    <div id="column2" class="column">
    <div class="habblet-container ">
    <div class="cbb clearfix notitle ">

    <div id="article-wrapper">
    <h2>Kommentare</h2><div class="article-meta"></div>
    <div class="article-body"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="<?php echo $path; ?>/articles/<?php echo $news_id; ?>" num_posts="150" width="400"></fb:comments></p>
    <div class="article-body"><iframe src="http://www.facebook.com/plugins/likebo…book.com/pages/<?php echo $facebook; ?>&amp;width=292&amp;colorscheme=light&amp;connections=0&amp;stream=false&amp;header=false&amp;height=62" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:292px; height:62px;" allowTransparency="true"></iframe>
    </iframe>

    <script type="text/javascript" language="Javascript">
    document.observe("dom:loaded", function() {
    $$('.article-images a').each(function(a) {
    Event.observe(a, 'click', function(e) {
    Event.stop(e);
    Overlay.lightbox(a.href, "Image is loading");
    });
    });

    $$('a.article-127').each(function(a) {
    a.replace(a.innerHTML);
    });
    });
    </script>


    </div></div></div></div>

    </div>
    </div>

    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
    <?php } ?>

    <?php
    if(isset($_POST['post_comment'])):
    $error = array();

    $comentario = $_POST['comment'];

    if(empty($comentario))
    $error[] = "<font color='#ff0000'>Du hast keinen Text eingegeben!</font>";
    if(empty($error)):
    $sucess = "<font color='#009900'>Dein Kommentar wurde gespeichert!</font>";
    mysql_query("INSERT INTO `cms_comments`(`story`, `comment`, `date`, `author`) VALUES ('".$news_id."', '".$comentario."', '".time()."', '".$my_id."')");
    endif;
    foreach($error as $errors)
    $errorz = $errors;
    endif;

    ?>


    <?php
    $commentid = mysql_fetch_array(mysql_query("SELECT * FROM `cms_comments` ORDER BY id DESC LIMIT 1"));
    $mas = 1;
    $comid = $commentid['id']+$mas;
    ?>

    <div class="habblet-container ">

    <div class="cbb clearfix notitle ">

    <div id="article-wrapper"><h2>Kommentieren</h2>

    <div class="article-meta">
    <?php if(!empty($error)): echo '<b>'.$errorz.'</b>'; endif;
    if(!empty($sucess)): echo '<b>'.$sucess.'</b>'; endif; ?>

    <div class="article-body">

    <form action="/articles/<?php echo $news_id; ?>?articleid=<?php echo $news_id; ?>&commentid=<?php echo $comid; ?><?php echo $row12['id']; ?>&userid=<?php echo $my_id; ?>" method="post">

    <textarea name="comment" maxlength="500"></textarea><br /><br />

    <input type="submit" name="post_comment" value="Posten" />

    </form>

    </div>

    </div>

    </div>

    </div><style type="text/css">

    input[type="text"], input[type="password"] {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    width: 175px;

    padding: 5px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    input[type="submit"] {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    padding: 5px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    textarea {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    padding: 5px;

    width: 517px;

    height: 70px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    select {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    padding: 5px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    </style>

    <?php
    $sql1 = mysql_query("SELECT * FROM cms_comments WHERE story = '".$news_id."'");
    $total = mysql_num_rows($sql1);
    ?>


    <div class="habblet-container ">

    <div class="cbb clearfix notitle ">

    <div id="article-wrapper"><h2>Kommentare (<?php echo $total; ?>)</h2>

    <div class="article-meta"></div>

    <div class="article-body">

    <?php
    $sql1 = mysql_query("SELECT * FROM cms_comments WHERE story = '".$news_id."' ORDER BY id DESC");
    if(mysql_num_rows($sql1) > 0){
    ?>

    <?php while($row1 = mysql_fetch_assoc($sql1)){

    $userdata = mysql_fetch_assoc($userdata = mysql_query("SELECT * FROM users WHERE id = '".$row1['author']."'"));
    ?>


    <table width="528px">

    <tr>

    <td width="90px" valign="top">

    <div style="float:left"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=<?php echo $userdata['look']; ?>&size=b&direction=2&head_direction=3&gesture=sml&size=m"></div>


    </td>

    <td width="427px" valign="top">

    <strong>RE: <?php echo $news['title']; ?></strong><br /><br /><?php echo $row1['comment']; ?>

    </td>

    </tr>

    <tr>

    <td width="90px" valign="top">

    </td>

    <td width="427px" align="right">

    <i>Geschrieben von <strong><a href="/home/<?php echo $userdata['username']; ?>"><?php echo $userdata['username']; ?></a></strong> am <?php echo date('d.m.Y H:i:s', $row1['date']); ?></i><br /><br />

    </td>

    </tr>
    <?php } } ?>


    </table>

    </div>

    </div>

    </div>

    </div>
    </div>

    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>

    </div>
    <div id="column3" class="column">
    </div>

    <?php require_once('./templates/community_footer.php'); ?>[/hide]

  • [hide]/*
    Navicat MySQL Data Transfer

    Source Server : hotel
    Source Server Version : 50516
    Source Host : localhost:3306
    Source Database : phoenix

    Target Server Type : MYSQL
    Target Server Version : 50516
    File Encoding : 65001

    Date: 2012-09-01 13:43:00
    */

    SET FOREIGN_KEY_CHECKS=0;

    -- ----------------------------
    -- Table structure for `cms_news_vote`
    -- ----------------------------
    DROP TABLE IF EXISTS `cms_news_vote`;
    CREATE TABLE `cms_news_vote` (
    `id_user` int(10) unsigned NOT NULL,
    `id_news` int(10) unsigned NOT NULL,
    `vote_like` int(10) unsigned NOT NULL,
    `vote_unlike` int(10) unsigned NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    -- ----------------------------
    -- Records of cms_news_vote
    -- ----------------------------
    INSERT INTO `cms_news_vote` VALUES ('2061', '0', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2071', '0', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2083', '46', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2061', '46', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2061', '47', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2097', '47', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2095', '47', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2091', '47', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2098', '47', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2073', '47', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2063', '47', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2071', '50', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2135', '50', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2063', '51', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2071', '51', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2095', '51', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2118', '51', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2071', '46', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2072', '50', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2159', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2165', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2170', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2164', '52', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2187', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2177', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2197', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2199', '52', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2159', '0', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2159', '53', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2214', '53', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2218', '53', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2223', '53', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2196', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2159', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2164', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2164', '53', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2183', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2178', '54', '0', '1');
    INSERT INTO `cms_news_vote` VALUES ('2172', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2172', '53', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2261', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2207', '54', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2261', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2175', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2213', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2159', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2233', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2274', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2237', '55', '1', '0');
    INSERT INTO `cms_news_vote` VALUES ('2200', '55', '1', '0');[/hide]

    Da noch die Datenbank (Wegen News Vote ;D)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!