示例#1
0
<?php

/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: news.php
| Author: PHP-Fusion Development Team
| Co Author: Frederick MC Chan (Chan)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once file_exists('maincore.php') ? 'maincore.php' : __DIR__ . "/../../maincore.php";
if (!db_exists(DB_NEWS)) {
    redirect(BASEDIR . "error.php?code=404");
}
require_once THEMES . "templates/header.php";
require_once INCLUDES . "infusions_include.php";
require_once INFUSIONS . "news/infusion_db.php";
require_once NEWS_CLASS . "autoloader.php";
require_once INFUSIONS . "news/templates/news.php";
\PHPFusion\News\NewsServer::news()->display_news();
require_once THEMES . "templates/footer.php";
示例#2
0
    /**
     * News Item Container
     * @param      $info
     */
    function render_news($subject, $news, $info)
    {
        global $aidlink;
        $locale = fusion_get_locale();
        $news_settings = \PHPFusion\News\NewsServer::get_news_settings();
        add_to_jquery("\n\t\t\t\$('.news-img-header').hover(\n\t\t\t\tfunction() { \$(this).closest('.news-article').find('.news-snippet').css({'opacity': 1, 'height': " . $news_settings['news_thumb_h'] . " }); },\n\t\t\t\tfunction() { \$(this).closest('.news-article').find('.news-snippet').css({'opacity': 0}); }\n\t\t\t);\n\t\t\t");
        ?>
        <!--news_prepost_<?php 
        echo $info['news_id'];
        ?>
-->
        <article class="news-article">
            <div class="news-img-info" style="height: <?php 
        echo $news_settings['news_thumb_h'];
        ?>
px">
                <?php 
        echo $info['news_image'];
        ?>
                <div class="news-box-overlay">
                    <a title="<?php 
        echo $info['news_subject'];
        ?>
" href="<?php 
        echo $info['news_image_url'];
        ?>
" rel="bookmark">
                        <h4><?php 
        echo $info['news_subject'];
        ?>
</h4>
                        <?php 
        echo trim_text(strip_tags($info['news_news']), 120);
        ?>
                    </a>
                </div>
            </div>

            <h4 class="news-title-info">
                <a class="strong text-dark" href="<?php 
        echo $info['news_url'];
        ?>
">
                    <?php 
        $info['news_sticky'] ? "<i class='pull-right fa fa-warning icon-sm'></i>\n" : '';
        ?>
                    <?php 
        echo $info['news_subject'];
        ?>
                </a>
            </h4>
            <div class="news-poster-info">
                <div class="pull-left">
                    <?php 
        echo display_avatar($info, '30px', '', false, 'img-circle');
        ?>
                </div>
                <div class="overflow-hide">
                    <span class="news-author">
                        <?php 
        echo profile_link($info['user_id'], $info['user_name'], $info['user_status'], "text-lighter");
        ?>
                    </span>
                    <span class="news-date m-r-10">
                        <i class="fa fa-calendar fa-fw"></i> <?php 
        echo showdate("newsdate", $info['news_date']);
        ?>
                    </span>
                    <?php 
        if ($info['news_display_comments']) {
            ?>
                        <span class="news-comments"><i class="fa fa-comment-o"></i> <?php 
            echo $info['news_display_comments'];
            ?>
</span>
                    <?php 
        }
        ?>
                    <?php 
        if ($info['news_display_ratings']) {
            ?>
                        <span class="news-ratings"><i class="fa fa-star-o fa-fw"></i> <?php 
            echo $info['news_display_ratings'];
            ?>
</span>
                    <?php 
        }
        ?>
                    <span class="news-read">
                        <i class="fa fa-eye fa-fw"></i> <?php 
        echo number_format($info['news_reads']);
        ?>
                    </span>
                </div>
            </div>

            <div class="news-description-info">
                <?php 
        echo ucwords($locale['in']);
        ?>
                <?php 
        echo $info['news_cat_name'] ? "<a href='" . INFUSIONS . "news/news.php?cat_id=" . $info['news_cat_id'] . "'>" . $info['news_cat_name'] . "</a>" : "<a href='" . INFUSIONS . "news/news.php?cat_id=0&amp;filter=false'>" . $locale['news_0006'] . "</a>&nbsp;";
        ?>
                <br/>
                <?php 
        echo trim_text(strip_tags($info['news_news']), 250);
        ?>
            </div>

        </article>
        <!--//news_prepost_<?php 
        echo $info['news_id'];
        ?>
-->
        <?php 
    }
示例#3
0
    /**
     * News Item Page Template
     * @param $info
     */
    function render_news_item($info)
    {
        $locale = fusion_get_locale();
        $aidlink = fusion_get_aidlink();
        $news_settings = \PHPFusion\News\NewsServer::get_news_settings();
        $data = $info['news_item'];
        add_to_head("<link rel='stylesheet' href='" . INFUSIONS . "news/templates/css/news.css' type='text/css'>");
        add_to_head("<link rel='stylesheet' href='" . INCLUDES . "jquery/colorbox/colorbox.css' type='text/css' media='screen' />");
        add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/colorbox/jquery.colorbox.js'></script>");
        add_to_footer('<script type="text/javascript">
			$(document).ready(function() {
				$(".news-image-overlay").colorbox({
					transition: "elasic",
					height:"100%",
					width:"100%",
					maxWidth:"98%",
					maxHeight:"98%",
					scrolling:false,
					overlayClose:true,
					close:false,
					photo:true,
					onComplete: function(result) {
						$("#colorbox").live("click", function(){
						$(this).unbind("click");
						$.fn.colorbox.close();
						});
					},
					onLoad: function () {
					}
			   });
			});
			</script>');
        opentable($locale['news_0004']);
        echo render_breadcrumbs();
        echo "<!--news_pre_readmore-->";
        echo "<article class='news-item' style='display:block; width:100%; overflow:hidden;'>\n";
        echo "<h2 class='text-center'>" . $data['news_subject'] . "</h2>\n";
        echo "<div class='news_news text-dark m-t-20 m-b-20'>\n";
        if ($data['news_image_src']) {
            echo "<a class='" . $data['news_ialign'] . " news-image-overlay' href='" . $data['news_image_src'] . "'>\n            <img class='img-responsive' src='" . $data['news_image_src'] . "' alt='" . $data['news_subject'] . "' style='padding:5px; max-height:" . $news_settings['news_photo_h'] . "px; overflow:hidden;' /></a>";
        } elseif (!empty($data['news_cat_name']) && !empty($data['news_cat_image_src'])) {
            echo "<a class='" . $data['news_ialign'] . "' href='" . INFUSIONS . "news/news.php?cat_id=" . $data['news_cat_id'] . "'>\n            <img class='img-responsive' src='" . IMAGES_NC . $data['news_cat_image_src'] . "' style='padding:5px; max-height:" . $news_settings['news_photo_h'] . "px; alt='" . $data['cat_name'] . "' />\n            </a>";
        }
        echo $data['news_news'];
        echo "</div>\n";
        echo "<div class='news_extended text-dark m-t-20 m-b-20'>" . $data['news_extended'] . "</div>\n";
        echo "<div style='clear:both;'></div>\n";
        echo "<div class='well m-t-5 text-center'>\n";
        echo "<span class='news-action m-r-10'><i class='fa fa-user'></i>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</span>\n";
        echo "<span class='news-action m-r-10'><i class='fa fa-calendar'></i>" . showdate("newsdate", $data['news_datestamp']) . "</span>\n";
        echo "<span class='news-action'><i class='fa fa-eye'></i><span class='text-dark m-r-10'>" . number_format($data['news_reads']) . "</span>\n</span>";
        echo $data['news_allow_comments'] ? display_comments($data['news_comments'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#comments") : '';
        echo $data['news_allow_ratings'] ? "<span class='m-r-10'>" . display_ratings($data['news_sum_rating'], $data['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#ratings") . " </span>" : '';
        echo "<a class='m-r-10' title='" . $locale['news_0002'] . "' href='" . BASEDIR . "print.php?type=N&amp;item_id=" . $data['news_id'] . "'><i class='fa fa-print'></i></a>";
        echo iADMIN && checkrights("N") ? "<a title='" . $locale['news_0003'] . "' href='" . INFUSIONS . "news/news_admin.php" . $aidlink . "&amp;action=edit&amp;section=news_form&amp;news_id=" . $data['news_id'] . "' title='" . $locale['news_0003'] . "' />" . $locale['news_0003'] . "</a>\n" : "";
        echo "</div>";
        echo "<!--news_sub_readmore-->";
        echo !isset($_GET['readmore']) && $data['news_ext'] == "y" ? "<div class='m-t-20'>\n<a href='" . INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "' class='button'>" . $locale['news_0001'] . "</a>\n</div>\n" : "";
        if ($data['page_count'] > 0) {
            echo "<div class='text-center m-t-10'>\n" . makepagenav($_GET['rowstart'], 1, $data['page_count'], 3, INFUSIONS . "news/news.php?readmore=" . $_GET['readmore'] . "&amp;") . "\n</div>\n";
        }
        if ($data['news_allow_comments']) {
            echo "<hr />" . showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], INFUSIONS . "news/news.php?readmore=" . $_GET['readmore']) . "\n";
        }
        if ($data['news_allow_ratings']) {
            echo "<hr />" . showratings("N", $_GET['readmore'], INFUSIONS . "news/news.php?readmore=" . $_GET['readmore']) . "\n";
        }
        echo "</article>\n";
        closetable();
    }