function news() {
global $prefix, $db, $admin_file, $user, $conf, $confu, $confn, $home, $pagetitle;
$cwhere = catmids($conf['name'], "s.catid");
$newnum = user_news($user[3], $confn['newnum']);
$sbest = (isset($_GET['best'])) ? 1 : 0;
$shits = (isset($_GET['hits'])) ? 1 : 0;
$scat = (isset($_GET['cat'])) ? intval($_GET['cat']) : 0;
if ($sbest && $confn['newrate']) {
$caton = 0;
$field = "best=1&";
$order = "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.score DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = _BEST;
$pagetitle = $conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($shits && $confn['newrate']) {
$caton = 0;
$field = "hits=1&";
$order = "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.counter DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = _POP;
$pagetitle = $conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($scat) {
$caton = 1;
$field = "cat=$scat&";
list($cat_title, $cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM
".$prefix."_categories WHERE id='$scat'"));
$order = "WHERE s.catid='$scat' AND s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC";
$ordernum = "catid='$scat' AND time <= now() AND status!='0'";
$pagetitle = $conf['defis']." "._NEWS." ".$conf['defis']." $cat_title";
} else {
$caton = 1;
$field = "";
$order = (!$home) ? "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC" : "WHERE
s.ihome='0' AND s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC";
$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
$news_logo = _NEWS;
$pagetitle = $conf['defis']." $news_logo";
}
head();
if (!$home) {
if ($scat) {
menu($cat_title);
} else {
menu($news_logo);
}
if ($scat) templ("catlink", catlink($conf['name'], $scat, $confn['defis'], _NEWS));
if ($caton == 1) categories($conf['name'], $confn['newcol'], $confn['newsub'], $confn['newcatdesc'], $scat);
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newnum;
$offset = intval($offset);
##############################тут вставвили
$banner_counter= 1;
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, UNIX_TIMESTAMP(s.time) as formatted, s.hometext,
s.comments, s.counter, s.acomm, s.score, s.ratings, s.banner, c.id, c.title, c.description, c.img, u.user_name FROM
".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON
(s.uid=u.user_id) ".$order." LIMIT $offset, $newnum");
if ($db->sql_numrows($result) > 0) {
while (list($sid, $catid, $uname, $stitle, $formatted, $hometext, $comments, $counter, $acomm, $score,
$ratings, $banner, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result)) {
$time = date(_DATESTRING, $formatted);
$title = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\"
title=\"$stitle\">".$stitle."</a> ".new_graphic($formatted);
$read = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\"
title=\"$stitle\">"._READMORE."</a>";
$post = ($user_name) ? " "._POSTEDBY.": ".user_info($user_name, 1) : (($uname) ? " "._POSTEDBY.":
".$uname : " "._POSTEDBY.": ".$confu['anonym']);
$ndate = ($confn['newdate']) ? " "._DATE.": ".$time : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter : "";
if (!$acomm) {
if ($comments == 0) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\"
title=\"$stitle\">"._COMMENTS."</a>";
} elseif ($comments == 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\"
title=\"$stitle\">"._COMMENT.": $comments</a>";
} elseif ($comments > 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\"
title=\"$stitle\">"._COMMENTS.": $comments</a>";
}
} else {
$comm = "";
}
$hometext = bb_decode($hometext, $conf['name']);
if ($confn['key'] && $conf['keywords']){
$words = explode(', ', $conf['keywords']);
foreach($words as $word){
$hometext = preg_replace('#('.$word.')#i', '<strong>\\1</strong>', $hometext);
while(preg_match('#<([^>]*)<strong>([^<>]+)</strong>([^>]*)>#i', $hometext)){
$hometext = preg_replace('#<([^>]*)<strong>([^<>]+)</strong>([^>]*)>#i', '<\\1\\2\\3>', $hometext);
}
while(preg_match('#<strong><strong>([^<>]+)</strong></strong>#i', $hometext)){
$hometext = preg_replace('#<strong><strong>([^<>]+)</strong></strong>#i', '<strong>\\1</strong>',
$hometext);
}
}
}
$arating = " ".ajax_rating(0, $sid, $conf['name'], $ratings, $score, "");
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid);
$admin = (is_moder($conf['name'])) ? " ".add_menu($sid, "<a
href=\"".$admin_file.".php?op=news_add&id=".$sid."\" title=\""._FULLEDIT."\">"._FULLEDIT."</a>||<a
href=\"".$admin_file.".php?op=news_delete&id=".$sid."\" OnClick=\"return DelCheck(this, '"._DELETE."
"$stitle"?');\" title=\""._ONDELETE."\">"._ONDELETE."</a>") : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img
src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\"
vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\"
align=\"left\"><b>".$read."</b>".$post.$ndate.$reads.$comm."</td><td>".$arating."</td><td
align=\"right\">".$print.$admin."</td></tr></table>";
basic($cid, $cimg, $ctitle, $sid, $title, $hometext, $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);
####################тут втавили
if($banner_counter == 2 ){
?>
################начало твоего рекламного кода
<script type="text/javascript">
if(typeof teasernet=='undefined'){
var teasernet = new Array();
var teasernet_blockid = 9232;
}else
teasernet_blockid = 9232;
teasernet[teasernet_blockid] ={
'styles': {
'TABLE': 'border: 0px solid #CCCCCC; width: 100%; background: #FFFFFF;',
'TD': 'text-align: center; border: 0px solid #CCCCCC; background: #FFFFFF; font-size: 11px; color: #000000;',
'IMG': 'border:0; margin: 0 auto;',
'A': 'color:#2F4F4F; font-size: 11px;',
'AHOVER': 'color:#D50303; font-size: 11px;'
},
'padid': 2436,
'hor': 1,
'ver': 8,
'size': 100
};
document.write('<div id="teasernet_'+teasernet_blockid+'"></div><scr'+'ipt type="text/jav'+
'ascript" src="http://echo.teasernet.ru/step1.php?padid=2436&blockid='+teasernet_blockid+
'&count='+(teasernet[teasernet_blockid].hor*teasernet[teasernet_blockid].ver)+
'&ref='+escape(document.referrer)+'&'+Math.round(Math.random()
0000)+'"></scr'+
'ipt>');
</script>
################конец твоего рекламного кода
<?php
}
$banner_counter++;
###########тут закончмили
echo bb_decode($banner, $conf['name']);
}
num_article($conf['name'], $newnum, $field, "sid", "_stories", "catid", $ordernum);
}
foot();
}