Początkujący
Postów: 105 Ostrzeżeń: 2
v7.02.07 Data rejestracji: 05.12.2008 17:27
|
news.php:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: news.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| 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 http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
// Predefined variables, do not edit these values
$i = 0;
// Number of news displayed
$items_per_page = $settings['newsperpage'];
add_to_title($locale['global_200'].$locale['global_077']);
if (!isset($_GET['readmore']) || !isnum($_GET['readmore'])) {
$rows = dbcount(
"(news_id)",
DB_NEWS,
groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
AND (news_end='0'||news_end>=".time().")
AND news_draft='0'"
);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows) {
$result = dbquery(
"SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
FROM ".DB_NEWS." tn
LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
AND (news_end='0'||news_end>=".time().") AND news_draft='0'
GROUP BY news_id
ORDER BY news_sticky DESC, news_datestamp DESC LIMIT ".$_GET['rowstart'].",".$items_per_page
);
$numrows = dbrows($result);
while ($data = dbarray($result)) {
$i++;
$comments = dbcount("(comment_id)", DB_COMMENTS." WHERE comment_type='N' AND comment_hidden='0' AND comment_item_id='".$data['news_id']."'");
$news_cat_image = "";
$news_subject = "<a name='news_".$data['news_id']."' id='news_".$data['news_id']."'></a>".stripslashes($data['news_subject']);
$news_cat_image = "<a href='".($settings['news_image_link'] == 0 ? "news_cats.php?cat_id=".$data['news_cat']
: FUSION_SELF."?readmore=".$data['news_id'] )."'>";
if ($data['news_image_t2'] && $settings['news_image_frontpage'] == 0) {
$news_cat_image .= "<img src='".IMAGES_N_T.$data['news_image_t2']."' alt='".$data['news_subject']."' class='news-category' /></a>";
} elseif ($data['news_cat_image']) {
$news_cat_image .= "<img src='".get_image("nc_".$data['news_cat_name'])."' alt='".$data['news_cat_name']."' class='news-category' /></a>";
} else {
$news_cat_image = "";
}
$news_news = $data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_news'])) : stripslashes($data['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" => $data['news_extended'] ? "y" : "n",
"news_reads" => $data['news_reads'],
"news_comments" => $comments,
"news_allow_comments" => $data['news_allow_comments'],
"news_sticky" => $data['news_sticky']
);
echo "<!--news_prepost_".$i."-->\n";
render_news($news_subject, $news_news, $news_info);
}
echo "<!--sub_news_idx-->\n";
if ($rows > $items_per_page) echo "<div align='center' style=';margin-top:5px;'>\n".makepagenav($_GET['rowstart'],$items_per_page,$rows,3)."\n</div>\n";
} else {
opentable($locale['global_077']);
echo "<div style='text-align:center'><br />\n".$locale['global_078']."<br /><br />\n</div>\n";
closetable();
}
} else {
$result = dbquery(
"SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status FROM ".DB_NEWS." tn
LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
WHERE ".groupaccess('news_visibility')." AND news_id='".$_GET['readmore']."' AND news_draft='0'
LIMIT 1"
);
if (dbrows($result)) {
include INCLUDES."comments_include.php";
include INCLUDES."ratings_include.php";
$data = dbarray($result);
if (!isset($_POST['post_comment']) && !isset($_POST['post_rating'])) {
$result2 = dbquery("UPDATE ".DB_NEWS." SET news_reads=news_reads+1 WHERE news_id='".$_GET['readmore']."'");
$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_news = stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news']);
if ($data['news_breaks'] == "y") { $news_news = nl2br($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, $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);
}
}
require_once THEMES."templates/footer.php";
?>
theme.php:
<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }
define("THEME_BULLET", "<span class='bullet'>·</span>");
define("THEME_WIDTH", "998px");
require_once INCLUDES."theme_functions_include.php";
function render_page($license=false) {
global $settings, $main_style, $locale;
//Header
echo "<table cellpadding='0' cellspacing='0' width='".THEME_WIDTH."' align='center'>\n<tr>\n";
echo "<td class='full-header'>\n<center>\n".showbanners()."</center>\n</td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='".THEME_WIDTH."' align='center'>\n<tr>\n";
echo "<td class='sub-header-left'></td>\n";
echo "<td class='sub-header'>".showsublinks(" ".THEME_BULLET." ", "white")."</td>\n";
echo "<td align='right' class='sub-header'><div style='vertical-align:middle;border:0;'><script type='text/javascript'>
var nk_wg = ({
content: null,
host: 'http://nk.pl/',
image: 'http://0.s-nk.pl/img/nk_widgets/nk_btn/nk_btn_311'
});
</script>
<script type='text/javascript'
src='http://0.s-nk.pl/script/sledzik/widgets/sledzik_widget_shout'></script>
</div></td>\n";
echo "<td align='right' class='sub-header'><!-- AddThis Button BEGIN -->
<a class='addthis_button' href='http://www.addthis.com/bookmark.php?v=250&pubid=ra-4e3672663ef8c445'><img src='/images/addthis.png' style='vertical-align:middle;border:0;' align='right'/></a>
<script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4e3672663ef8c445'></script>
<!-- AddThis Button END --></td>\n";
echo "<td class='sub-header-right'></td>\n";
echo "</tr>\n</table>\n";
//Nasi herby
echo "<table cellpadding='1' cellspacing='1' align='center' bgcolor='#ffdfae' width='998px'>\n<tr>\n";
echo "<td align='center' nowrap='nowrap'>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=117' target='_blank'><img src='/herby/aleksandrow.png' title='Sokol II Aleksandrow' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=118' target='_blank'><img src='/herby/andrzejow.png' title='Polonia Andrzejow' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=119' target='_blank'><img src='/herby/dlutow.png' title='GLKS Dlutow' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=120' target='_blank'><img src='/herby/galkowek.png' title='LKS Galkowek' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=121' target='_blank'><img src='/herby/glowno.png' title='Stal Glowno' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=122' target='_blank'><img src='/herby/koluszki.png' title='KKS Koluszki' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=123' target='_blank'><img src='/herby/kolejarz.png' title='Kolejarz Lodz' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=124' target='_blank'><img src='/herby/kutno.png' title='MKS II Kutno' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=126' target='_blank'><img src='/herby/leczyca.png' title='Gornik Leczyca' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=5' target='_blank'><img src='/herby/logomglks.png' title='MGLKS Termy Uniejow/Ostrowsko' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=127' target='_blank'><img src='/herby/pabianice.png' title='PTC Pabianice' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=128' target='_blank'><img src='/herby/parzeczew.png' title='Orzel Parzeczew' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=129' target='_blank'><img src='/herby/rabien.png' title='Victoria Rabien' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=130' target='_blank'><img src='/herby/rogow.png' title='Pogon Rogow' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=131' target='_blank'><img src='/herby/rozyca.png' title='LKS Rozyca' border='0' /></a>
<img src='/images/listwa.png'>
<a href='/viewpage.php?page_id=132' target='_blank'><img src='/herby/wisniowa.png' title='Andrespolia Wisniowa Gora' border='0' /></a>
<img src='/images/listwa.png'>
</td>\n";
echo "</tr>\n</table>\n";
//Content
echo "<table cellpadding='0' cellspacing='0' width='".THEME_WIDTH."' align='center' class='$main_style'>\n<tr>\n";
if (LEFT) { echo "<td class='side-border-left' valign='top'>".LEFT."</td>"; }
echo "<td class='main-bg' valign='top'>".U_CENTER.CONTENT.L_CENTER."</td>";
if (RIGHT) { echo "<td class='side-border-right' valign='top'>".RIGHT."</td>"; }
echo "</tr>\n</table>\n";
//Footer
echo "<table cellpadding='0' cellspacing='0' width='".THEME_WIDTH."' align='center'>\n<tr>\n";
echo "<td class='sub-header-left'></td>\n";
echo "<td align='left' class='sub-header'>".sprintf($locale['global_172'], substr((get_microtime() - START_TIME),0,4))."</td>\n";
echo "<td align='right' class='sub-header'>".showcounter()."</td>\n";
echo "<td class='sub-header-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='".THEME_WIDTH."' align='center'>\n<tr>\n";
echo "<td align='center' class='main-footer'>".stripslashes($settings['footer']);
if (!$license) { echo "<br /><br />\n".showcopyright(); }
echo "</td>\n";
echo "</tr>\n</table>\n";
echo "<center><script TYPE='text/javascript' src='http://www.cpmprofit.com/ads.php?r=114142868d74c010ec80876b82df72d8f7d4358e96968604&popup=0'></script></center>\n";
echo "<center><script TYPE='text/javascript' src='http://www.cpmprofit.com/ads.php?r=114142868d74c010ec80876b82df72d8f7d4358e96968604&popup=0'></script></center>\n";
/*foreach ($mysql_queries_time as $query) {
echo $query[0]." QUERY: ".$query[1]."<br />";
}*/
}
/* New in v7.02 - render comments */
function render_comments($c_data, $c_info){
global $locale, $settings;
opentable($locale['c100']);
if (!empty($c_data)){
echo "<div class='comments floatfix'>\n";
$c_makepagenav = '';
if ($c_info['c_makepagenav'] !== FALSE) {
echo $c_makepagenav = "<div style='text-align:center;margin-bottom:5px;'>".$c_info['c_makepagenav']."</div>\n";
}
foreach($c_data as $data) {
$comm_count = "<a href='".FUSION_REQUEST."#c".$data['comment_id']."' id='c".$data['comment_id']."' name='c".$data['comment_id']."'>#".$data['i']."</a>";
echo "<div class='tbl2 clearfix floatfix'>\n";
if ($settings['comments_avatar'] == "1") { echo "<span class='comment-avatar'>".$data['user_avatar']."</span>\n"; }
echo "<span style='float:right' class='comment_actions'>".$comm_count."\n</span>\n";
echo "<span class='comment-name'>".$data['comment_name']."</span>\n<br />\n";
echo "<span class='small'>".$data['comment_datestamp']."</span>\n";
if ($data['edit_dell'] !== false) { echo "<br />\n<span class='comment_actions'>".$data['edit_dell']."\n</span>\n"; }
echo "</div>\n<div class='tbl1 comment_message'>".$data['comment_message']."</div>\n";
}
echo $c_makepagenav;
if ($c_info['admin_link'] !== FALSE) {
echo "<div style='float:right' class='comment_admin'>".$c_info['admin_link']."</div>\n";
}
echo "</div>\n";
} else {
echo $locale['c101']."\n";
}
closetable();
}
function render_news($subject, $news, $info) {
//Kolor po najechaniu
echo
"<script language=\"javascript\">
function ColorIn(id) {
mint.fx.Color(id, \"backgroundColor\", null, \"feffad\", 20, 500);
}
function ColorOut(id) {
mint.fx.Color(id, \"backgroundColor\", null, \"ffffff\", 20, 500);
}
</script>\n"
;
//Kolor po najechaniu
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$subject."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' class='spacer'>\n<tr>\n";
//Kolor po najechaniu
echo "<td class='main-body middle-border' onmouseover=\"ColorIn(this)\" onmouseout=\"ColorOut(this)\">".parseubb($info['cat_image'].$news)."</td>\n";
//Kolor po najechaniu
echo "</tr>\n<tr>\n";
echo "<td align='center' class='news-footer middle-border'>\n";
echo newsposter($info," ·").newsopts($info,"·").itemoptions("N",$info['news_id']);
echo "</td>\n";
echo "</tr><tr>\n";
echo "<td style='height:5px;background-color:#ffbf00;'></td>\n";
echo "</tr>\n</table>\n";
}
function render_article($subject, $article, $info) {
echo "<table width='100%' cellpadding='0' cellspacing='0'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$subject."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' class='spacer'>\n<tr>\n";
echo "<td class='main-body middle-border'>".($info['article_breaks'] == "y" ? nl2br($article) : $article)."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' class='news-footer'>\n";
echo articleposter($info," ·").articleopts($info,"·").itemoptions("A",$info['article_id']);
echo "</td>\n</tr>\n</table>\n";
}
function opentable($title) {
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$title."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";
echo "<td class='main-body'>\n";
}
function closetable() {
echo "</td>\n";
echo "</tr><tr>\n";
echo "<td style='height:5px;background-color:#ffbf00;'></td>\n";
echo "</tr>\n</table>\n";
}
function openside($title, $collapse = false, $state = "on") {
global $panel_collapse; $panel_collapse = $collapse;
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='scapmain-left'></td>\n";
echo "<td class='scapmain'>$title</td>\n";
if ($collapse == true) {
$boxname = str_replace(" ", "", $title);
echo "<td class='scapmain' align='right'>".panelbutton($state, $boxname)."</td>\n";
}
echo "<td class='scapmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";
echo "<td class='side-body'>\n";
if ($collapse == true) { echo panelstate($state, $boxname); }
}
function closeside() {
global $panel_collapse;
if ($panel_collapse == true) { echo "</div>\n"; }
echo "</td>\n</tr>\n</table>\n";
}
?>
|