$data['news_reads']++; } $news_cat_image = ""; $news_subject = $data['news_subject']; if ($data['news_image_t1'] && $settings['news_image_readmore'] == "0") { $img_size = @getimagesize(IMAGES_N . $data['news_image']); $news_cat_image = "<a href=\"javascript:;\" onclick=\"window.open('" . IMAGES_N . $data['news_image'] . "','','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=" . ($img_size[0] + 20) . ",height=" . ($img_size[1] + 20) . "')\"><img src='" . IMAGES_N_T . $data['news_image_t1'] . "' alt='" . $data['news_subject'] . "' class='news-category' /></a>"; } elseif ($data['news_cat_image']) { $news_cat_image = "<a href='news_cats.php?cat_id=" . $data['news_cat'] . "'><img src='" . get_image("nc_" . $data['news_cat_name']) . "' alt='" . $data['news_cat_name'] . "' class='news-category' /></a>"; } $news_news = preg_split("/<!?--\\s*pagebreak\\s*-->/i", $data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news'])) : stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news'])); $pagecount = count($news_news); $news_info = array("news_id" => $data['news_id'], "user_id" => $data['user_id'], "user_name" => $data['user_name'], "user_status" => $data['user_status'], "news_date" => $data['news_datestamp'], "cat_id" => $data['news_cat'], "cat_name" => $data['news_cat_name'], "cat_image" => $news_cat_image, "news_subject" => $data['news_subject'], "news_ext" => "n", "news_reads" => $data['news_reads'], "news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='" . $data['news_id'] . "' AND comment_hidden='0'"), "news_allow_comments" => $data['news_allow_comments'], "news_sticky" => $data['news_sticky']); add_to_title($locale['global_201'] . $news_subject); echo "<!--news_pre_readmore-->"; render_news($news_subject, $news_news[$_GET['rowstart']], $news_info); echo "<!--news_sub_readmore-->"; if ($pagecount > 1) { echo "<div align='center' style='margin-top:5px;'>\n" . makepagenav($_GET['rowstart'], 1, $pagecount, 3, FUSION_SELF . "?readmore=" . $_GET['readmore'] . "&") . "\n</div>\n"; } if ($data['news_allow_comments']) { showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], FUSION_SELF . "?readmore=" . $_GET['readmore']); } if ($data['news_allow_ratings']) { showratings("N", $_GET['readmore'], FUSION_SELF . "?readmore=" . $_GET['readmore']); } } else { redirect(FUSION_SELF); } } require_once THEMES . "templates/footer.php";
/** * News Page Template * @param $info */ function render_main_news($info) { global $userdata, $settings, $news_settings, $locale; add_to_head("<link href='" . INFUSIONS . "news/templates/css/news.css' rel='stylesheet'/>\n"); add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/jquery.cookie.js'></script>"); if (isset($_POST['switchview'])) { add_to_jquery("\$.cookie('fusion_news_view', '" . $_POST['switchview'] . "', {expires: 7});"); $_COOKIE['fusion_news_view'] = $_POST['switchview']; } opentable($locale['news_0004']); echo render_breadcrumbs(); /* Slideshow */ $carousel_indicators = ''; $carousel_item = ''; $res = 0; $carousel_height = "300"; if (!empty($info['news_items'])) { $i = 0; foreach ($info['news_items'] as $news_item) { if ($news_item['news_image_src'] && file_exists($news_item['news_image_src'])) { $carousel_active = $res == 0 ? 'active' : ''; $res++; $carousel_indicators .= "<li data-target='#news-carousel' data-slide-to='{$i}' class='" . $carousel_active . "'></li>\n"; $carousel_item .= "<div class='item " . $carousel_active . "'>\n"; $carousel_item .= "<img class='img-responsive' style='position:absolute; width:100%; margin-top:-25%' src='" . $news_item['news_image_src'] . "' alt='" . $news_item['news_subject'] . "'>\n"; $carousel_item .= "\n\t\t\t\t\t<div class='carousel-caption'>\n\t\t\t\t\t\t<div class='overflow-hide'>\n\t\t\t\t\t\t<a class='text-white' href='" . INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "'><h4 class='text-white m-t-10'>" . $news_item['news_subject'] . "</h4></a>\n\n\t\t\t\t\t\t<span class='news-carousel-action m-r-10'><i class='fa fa-eye fa-fw'></i>" . $news_item['news_reads'] . "</span>\n\t\t\t\t\t\t" . ($news_item['news_allow_comments'] ? "<span class='m-r-10'>" . display_comments($news_item['news_comments'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#comments") . "</span>" : '') . "\n\t\t\t\t\t\t" . ($news_item['news_allow_ratings'] ? "<span class='m-r-10'>" . display_ratings($news_item['news_sum_rating'], $news_item['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#postrating") . " </span>" : '') . "\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t</div>\n</div>\n\n\t\t\t\t\t"; $i++; } } } /* Title Panel */ if (!isset($_GET['readmore'])) { if ($res) { echo "<div id='news-carousel' class='carousel slide' data-interval='20000' data-ride='carousel'>\n"; if ($res > 1) { echo "<ol class='carousel-indicators'>\n"; echo $carousel_indicators; echo "</ol>"; } echo "<div class='carousel-inner' style='height:" . $carousel_height . "px' role='listbox'>\n"; echo $carousel_item; echo "</div>\n"; echo "\n\t\t\t\t<a class='left carousel-control' href='#news-carousel' role='button' data-slide='prev'>\n\t\t\t\t\t<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['previous'] . "</span>\n\t\t\t \t</a>\n\t\t\t \t<a class='right carousel-control' href='#news-carousel' role='button' data-slide='next'>\n\t\t\t\t\t<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['next'] . "</span>\n\t\t\t \t</a>\n\n\t\t\t\t"; echo "</div>\n"; } echo "<div class='panel panel-default panel-news-header'>\n"; echo "<div class='panel-body'>\n"; echo "<div class='pull-right'>\n"; echo "<a class='btn btn-sm btn-default text-dark' href='" . INFUSIONS . "news/news.php'><i class='entypo newspaper'></i>" . $locale['news_0007'] . "</a>\n"; echo "<button type='button' class='btn btn-sm btn-primary' data-toggle='collapse' data-target='#newscat' aria-expanded='true' aria-controls='newscat'><i class='entypo book open'></i>" . $locale['news_0009'] . "</button>\n"; echo "</div>\n"; echo "<div class='pull-left m-r-10' style='position:relative; margin-top:-30px;'>\n"; echo "<div style='max-width:80px;'>\n"; echo $info['news_cat_image']; echo "</div>\n"; echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo "<h3 class='display-inline text-dark'>" . $info['news_cat_name'] . "</h3><br/><span class='strong'>" . $locale['news_0008'] . ":</span> <span class='text-dark'>\n\n\t\t\t" . ($info['news_last_updated'] > 0 ? showdate('newsdate', $info['news_last_updated']) : $locale['na']) . "</span>"; echo "</div>\n"; echo "</div>\n"; echo "<div id='newscat' class='panel-collapse collapse m-b-10'>\n"; echo "<!--pre_news_cat_idx-->"; echo "<ul class='list-group'>\n"; echo "<li class='list-group-item'><hr class='m-t-0 m-b-5'>\n"; echo "<span class='display-inline-block m-b-10 strong text-smaller text-uppercase'> " . $locale['news_0010'] . "</span><br/>\n"; foreach ($info['news_categories'] as $cat_id => $cat_data) { echo isset($_GET['cat_id']) && $_GET['cat_id'] == $cat_id ? '' : "<a href='" . INFUSIONS . "news/news.php?cat_id=" . $cat_id . "' class='btn btn-sm btn-default'>" . $cat_data['name'] . "</a>"; } echo "<a href='" . INFUSIONS . "news/news.php?cat_id=0' class='btn btn-sm btn-default'>" . $locale['news_0006'] . "</a>\n"; echo "</li>"; echo "</ul>\n"; echo "<!--sub_news_cat_idx-->\n"; echo "</div>\n</div>\n"; echo "<div class='row m-b-20 m-t-20'>\n"; echo "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>\n"; echo openform('viewform', 'post', FUSION_REQUEST, array('max_tokens' => 1, 'class' => 'pull-right display-inline-block m-l-10')); echo "<div class='btn-group'>\n"; $active = isset($_COOKIE['fusion_news_view']) ? $_COOKIE['fusion_news_view'] : ''; echo form_button('switchview', '', '1', array('class' => "btn-sm btn-default nsv " . ($active == 1 ? 'active' : '') . " ", 'icon' => 'entypo layout', 'alt' => $locale['news_0014'])); echo form_button('switchview', '', '2', array('class' => "btn-sm btn-default nsv " . ($active == 2 ? 'active' : '') . "", 'icon' => 'entypo menu', 'alt' => $locale['news_0015'])); echo "</div>\n"; echo closeform(); // Filters echo "<div class='display-inline-block'>\n"; echo "<span class='text-dark strong m-r-10'>" . $locale['show'] . " :</span>"; $i = 0; foreach ($info['news_filter'] as $link => $title) { $filter_active = !isset($_GET['type']) && $i == '0' || isset($_GET['type']) && stristr($link, $_GET['type']) ? 'text-dark strong' : ''; echo "<a href='" . $link . "' class='display-inline {$filter_active} m-r-10'>" . $title . "</a>"; $i++; } echo "</div>\n"; // end filter. echo "</div>\n</div>\n"; $news_span = $active == 2 ? 12 : 4; if (!empty($info['news_items'])) { echo "<div class='row'>\n"; foreach ($info['news_items'] as $i => $news_info) { echo "<div class='col-xs-12 col-sm-{$news_span} col-md-{$news_span} col-lg-{$news_span}'>\n"; echo isset($_GET['cat_id']) ? "<!--pre_news_cat_idx-->\n" : "<!--news_prepost_" . $i . "-->\n"; render_news($news_info['news_subject'], $news_info['news_news'], $news_info, $active == 2); echo isset($_GET['cat_id']) ? "<!--sub_news_cat_idx-->" : "<!--sub_news_idx-->\n"; echo "</div>\n"; } echo "</div>\n"; if ($info['news_item_rows'] > $news_settings['news_pagination']) { $type_start = isset($_GET['type']) ? "type=" . $_GET['type'] . "&" : ''; $cat_start = isset($_GET['cat_id']) ? "cat_id=" . $_GET['cat_id'] . "&" : ''; echo "<div class='text-center m-t-10 m-b-10'>" . makepagenav($_GET['rowstart'], $news_settings['news_pagination'], $info['news_item_rows'], 3, INFUSIONS . "news/news.php?" . $cat_start . $type_start) . "</div>\n"; } } else { echo "<div class='well text-center'>" . $locale['news_0005'] . "</div>\n"; } } else { render_news_item($info); } closetable(); }
/** * News Page Template * @param $info */ function render_main_news($info) { $news_settings = \PHPFusion\News\NewsServer::get_news_settings(); $locale = fusion_get_locale(); /* Slideshow */ $carousel_indicators = ''; $carousel_item = ''; $carousel_height = "350"; $limit_per_showcase = 5; $carousel_count = 0; if (!empty($info['news_items'])) { $showcase_slides = array_chunk($info['news_items'], $limit_per_showcase, TRUE); foreach ($showcase_slides as $news_slides) { if (!empty($news_slides)) { $item_count = 1; $small_items = array(); $small_items_image = array(); $carousel_active = $carousel_count == 0 ? 'active' : ''; // Uncomment this to get the carousel indicator //$carousel_indicators .= "<li data-target='#news-carousel' data-slide-to='$carousel_count' class='".$carousel_active."'></li>\n"; $carousel_count++; foreach ($news_slides as $news_item) { $image_src = !empty($news_item['news_image_src']) && file_exists($news_item['news_image_src']) ? $news_item['news_image_src'] : THEME . "images/news.jpg"; ob_start(); ?> <div class='item-caption overflow-hide'> <label class="label label-news"> <?php echo $news_item['news_cat_name']; ?> </label> <span class="label-date"> <i class="fa fa-clock-o fa-fw m-r-5"></i> <?php echo showdate('newsdate', $news_item['news_date']); ?> </span> <a class='text-white' href='<?php echo INFUSIONS . "news/news.php?readmore=" . $news_item['news_id']; ?> '> <h4 class='text-white m-t-10'><?php echo $news_item['news_subject']; ?> </h4> </a> <?php if ($news_item['news_allow_comments']) { ?> <span class='m-r-10'><?php echo display_comments($news_item['news_comments'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#comments"); ?> </span> <?php } ?> <?php if ($news_item['news_allow_ratings']) { ?> <span class='m-r-10'><?php echo display_ratings($news_item['news_sum_rating'], $news_item['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#postrating"); ?> </span> <?php } ?> </div> <?php $item = ob_get_contents(); ob_end_clean(); if ($item_count == 1) { // big sized ones $big_item = $item; $big_item_image = $image_src; } else { // small sized ones $small_items[] = $item; $small_items_image[] = $image_src; } $item_count++; if ($item_count == $limit_per_showcase + 1) { $item_count = 1; } } $carousel_item .= "<div class='item " . $carousel_active . "'>\n"; $carousel_item .= "<div class='col-xs-12 col-sm-6 item-lg' style='height: " . $carousel_height . "px; background-image: url({$big_item_image}); background-size: cover;'>"; $carousel_item .= "<div class='item-inner'>\n"; $carousel_item .= $big_item; $carousel_item .= "</div>"; $carousel_item .= "</div>"; $carousel_item .= "<div class='col-xs-6 col-sm-6 p-0'>\n"; if (!empty($small_items)) { $i_count = 1; foreach ($small_items as $iCount => $small_item_info) { $carousel_item .= "<div class='col-xs-6 col-sm-6 p-0'>"; $carousel_item .= "<div class='item-sm' style='" . ($i_count > 2 ? "margin-left: 5px; margin-top:5px; height: " . ($carousel_height / 2 - 5) . "px;" : "margin-left: 5px; height: " . $carousel_height / 2 . "px;") . " background-image: url({$small_items_image[$iCount]}); background-size: cover;'>\n"; $carousel_item .= "<div class='item-inner'>\n"; $carousel_item .= $small_item_info; $carousel_item .= "</div>\n"; $carousel_item .= "</div>\n"; $carousel_item .= "</div>"; $i_count++; } } $carousel_item .= "</div>\n"; $carousel_item .= "</div>\n"; } } } if ($carousel_count) { $carousel_html = "<div id='news-carousel' class='carousel slide m-b-20' data-interval='20000' data-ride='carousel'>\n"; if ($carousel_count > 1 && !empty($carousel_indicators)) { $carousel_html .= "<ol class='carousel-indicators'>\n"; $carousel_html .= $carousel_indicators; $carousel_html .= "</ol>"; } $carousel_html .= "<div class='carousel-inner' style='height:" . $carousel_height . "px' role='listbox'>\n"; $carousel_html .= $carousel_item; $carousel_html .= "</div>\n"; if ($carousel_count > 1) { $carousel_html .= "\n\t\t\t\t<a class='left carousel-control' href='#news-carousel' role='button' data-slide='prev'>\n\t\t\t\t\t<span class='fa fa-chevron-left' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['previous'] . "</span>\n\t\t\t \t</a>\n\t\t\t \t<a class='right carousel-control' href='#news-carousel' role='button' data-slide='next'>\n\t\t\t\t\t<span class='fa fa-chevron-right' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['next'] . "</span>\n\t\t\t \t</a>\n\n\t\t\t\t"; } $carousel_html .= "</div>\n"; // Inject into header of Septenary \PHPFusion\SeptenaryTheme::Factory()->set_header_html($carousel_html); } // Process and inject all news categories to Left Panel ob_start(); openside($locale['news_0009']); ?> <ul> <?php if (!empty($info['news_categories'])) { foreach ($info['news_categories'] as $cat_id => $cat_data) { echo isset($_GET['cat_id']) && $_GET['cat_id'] == $cat_id ? '' : "<li>\n<a href='" . INFUSIONS . "news/news.php?cat_id=" . $cat_id . "'>" . $cat_data['name'] . "</a>\n</li>\n"; } echo "<li>\n<a href='" . INFUSIONS . "news/news.php?cat_id=0'>" . $locale['news_0006'] . "</a>\n</li>\n"; } else { echo "<li>\n<a href='" . INFUSIONS . "news/news.php?cat_id=0'>" . $locale['news_0006'] . "</a>\n</li>\n"; } ?> </ul> <?php closeside(); $left_html = ob_get_contents(); ob_end_clean(); \PHPFusion\SeptenaryTheme::Factory()->set_left_html($left_html); echo render_breadcrumbs(); // Build filters $i = 0; foreach ($info['news_filter'] as $link => $title) { $tab_title['title'][] = $title; $tab_title['id'][] = $i; $i++; } $active_tab = tab_active($tab_title, 0, 'type'); ?> <div id="news_filter_tab"> <?php echo opentab($tab_title, $active_tab, 'filters', TRUE, '', 'type'); if (!empty($info['news_items'])) { echo "<div class='row'>\n"; foreach ($info['news_items'] as $i => $news_info) { echo "<div class='" . \PHPFusion\SeptenaryComponents::col_span(4, 6, 6) . "'>\n"; echo isset($_GET['cat_id']) ? "<!--pre_news_cat_idx-->\n" : "<!--news_prepost_" . $i . "-->\n"; render_news($news_info['news_subject'], $news_info['news_news'], $news_info, FALSE); echo isset($_GET['cat_id']) ? "<!--sub_news_cat_idx-->" : "<!--sub_news_idx-->\n"; echo "</div>\n"; } echo "</div>\n"; if ($info['news_total_rows'] > $news_settings['news_pagination']) { $type_start = isset($_GET['type']) ? "type=" . $_GET['type'] . "&" : ''; $cat_start = isset($_GET['cat_id']) ? "cat_id=" . $_GET['cat_id'] . "&" : ''; echo "<div class='text-center m-t-10 m-b-10'>" . makepagenav($_GET['rowstart'], $news_settings['news_pagination'], $info['news_total_rows'], 3, INFUSIONS . "news/news.php?" . $cat_start . $type_start) . "</div>\n"; } } else { echo "<div class='well text-center'>" . $locale['news_0005'] . "</div>\n"; } echo closetab(); ?> </div> <?php }
if (dbrows($result2)) { $data2 = dbarray($result2); $news_cat_image = "<a href='news_cats.php?cat_id=" . $data2['news_cat_id'] . "'><img src='" . get_image("nc_" . $data2['news_cat_name']) . "' alt='" . $data2['news_cat_name'] . "' class='news-category' /></a>"; } } $news_news = stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news']); if ($data['news_breaks'] == "y") { $news_news = nl2br($news_news); } if ($news_cat_image != "") { $news_news = $news_cat_image . $news_news; } $news_info = array("news_id" => $data['news_id'], "user_id" => $data['user_id'], "user_name" => $data['user_name'], "news_date" => $data['news_datestamp'], "news_ext" => "n", "news_reads" => $data['news_reads'], "news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='" . $data['news_id'] . "'"), "news_allow_comments" => $data['news_allow_comments']); add_to_title($locale['global_201'] . $news_subject); echo "<!--news_pre_readmore-->"; render_news($news_subject, $news_news, $news_info); echo "<!--news_sub_readmore-->"; if ($data['news_allow_comments']) { showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], FUSION_SELF . "?readmore=" . $_GET['readmore']); } if ($data['news_allow_ratings']) { showratings("N", $_GET['readmore'], FUSION_SELF . "?readmore=" . $_GET['readmore']); } } else { redirect(FUSION_SELF); } } else { redirect(FUSION_SELF); } } require_once THEMES . "templates/footer.php";