0) && (!ctype_digit($id_site))) die ("Request failed."); if (isset($id_author) && (strlen($id_author) > 0) && (!ctype_digit($id_author))) die ("Request failed."); if (isset($newsdate) && (strlen($newsdate) > 0) && (!ctype_digit($newsdate))) die ("Request failed."); if (isset($sortby) && (strlen($sortby) > 0) && (!ctype_digit($sortby))) die ("Request failed."); if (isset($sortorder) && (strlen($sortorder) > 0) && (!ctype_digit($sortorder))) die ("Request failed."); if (isset($showpage) && (strlen($showpage) > 0) && (!ctype_digit($showpage))) die ("Request failed."); if (isset($showtotal) && (strlen($showtotal) > 0) && (!ctype_digit($showtotal))) die ("Request failed."); if (isset($showby) && (strlen($showby) > 0) && (!ctype_digit($showby))) die ("Request failed."); if (isset($showussr) && (strlen($showussr) > 0) && (!ctype_digit($showussr))) die ("Request failed."); require_once("ttp_fns.php"); session_start(); $id_section=2; if($_SESSION["id_site"]) { unset($_SESSION["id_site"]); } if(!isset($id_site) && !isset($id_author)) { exit;} /// test /* else { if(isset($_SESSION["id_site"])) unset($_SESSION["id_site"]); // $_SESSION["id_site"] = $id_site; } /// end if(!isset($_SESSION["id_site"])) $_SESSION["id_site"] = $id_site; */ if (isset($_SESSION["bd_uchastnik"]) && isset($_SESSION["bd_kluch"])) { $cid = trans_connect($bd_uchastnik,$bd_kluch); } else $cid=trans_connect('',''); if (!$cid) failed_connection(); // $fe1000=1; function define_rates ($input) { if ($input>=70) $access_rate=4; elseif ($input>=50) $access_rate=3; elseif ($input>=30) $access_rate=2; else $access_rate=1; return $access_rate; } //для данного скрипта: //4=Chief Editor or Site Editor or News section Editor for this site; //3=Site reporter or News reporter for this site; //2=registered user; //1=others function set_access ($id_person,$id_site,$id_section) { global $cid; $q1=mysql_query("select max(priv) as privilege from sit_per where id_person=$id_person and ((id_site=$id_site and (id_section=$id_section or id_section=0)) or id_site=99 or id_site=91)",$cid); if (!$q1 or mysql_numrows($q1)==0) { $access_rate=1; } else { $r1=mysql_fetch_array($q1); $rp=$r1['privilege']; $access_rate=define_rates($rp); } return $access_rate; } if(!isset($id_site)) $id_site = 99; if ($_SESSION["id_posetitel"]) { $access_rate=set_access($id_posetitel,$id_site,$id_section); } else { $access_rate=1; } $q=mysql_query("select * from sites where id_site=$id_site",$cid); if(mysql_numrows($q)>0) { $r=mysql_fetch_array($q); $sitename=$r['name']; } else tail(); gl($sitename." // Новости // Версия 2.2"); //введите заголовок броузера gh(); $maxW=500.; $maxH=500.; if(!isset($sortby)) $sortby=0; if(!isset($sortorder)) $sortorder=0; if(!isset($showpage)) $showpage=0; if(!isset($showtotal)) $showtotal=0; if(!isset($showsite)) $showsite=0; if(!isset($showussr)) $showussr=0; $showby=10; //lekha 2004-02-07 if(!isset($approved)) $approved=1; /* // default newsdate had been set to current month (commented out) // now default newsdate is set to last month which news exist for if(!isset($newsdate)) { $newsdate=date("YmdHis",mktime(0,0,0,date("m"),date('d')-5,date("Y"))) .date("YmdHis",mktime(0,0,0,date("m")+1,1,date("Y"))-1); $newsdate=substr($newsdate,0,6).'00'.substr($newsdate,8,20); } */ ?>
\n"); ?> '); ?>
'); print(ru_month(substr($dateo,0,2),'I')/*.' '.substr($dateo,3,5)*/); print(' '); $prev_year = $new_year; // print(''); // print(ru_month(substr($dateo,0,2),'I').substr($dateo,2,5)); // ?> 0) print('
0) { $r=mysql_fetch_array($q); $id_comntype=$r['id_ntype']; } $dt_ownb=substr($newsdate,0,14); $dt_owne=substr($newsdate,14,14); $order='news.dt_own'; $sortcol=$order; if($sortorder==0) {$order.=' desc';} else {$order.=' asc';} if($showpage==0) { if(isset($id_author)) { $query="select distinct news.id_news from news where id_author=$id_author and $sortcol between '$dt_ownb' and '$dt_owne' and approved=$approved order by $order"; } else { if(!$showsite) { if(!$showussr) { $query="select distinct news.id_news from news,new_cit,sit_cit_typ,new_typ where ((id_ntype>=2 and news.id_news=new_cit.id_news and new_cit.id_city=sit_cit_typ.id_city) and sit_cit_typ.id_site=$id_site and news.id_news=new_typ.id_news and new_typ.id_type=sit_cit_typ.id_type) and $sortcol between '$dt_ownb' and '$dt_owne' and approved=$approved order by $order"; } else { $query="select distinct news.id_news from news,new_cit,sit_cit_typ,new_typ where ((id_ntype=$id_comntype or (id_ntype>=2 and news.id_news=new_cit.id_news and new_cit.id_city=sit_cit_typ.id_city)) and sit_cit_typ.id_site=$id_site and news.id_news=new_typ.id_news and new_typ.id_type=sit_cit_typ.id_type) and $sortcol between '$dt_ownb' and '$dt_owne' and approved=$approved order by $order"; } } else { if(!$showussr) { $query="select distinct news.id_news from news,new_cit,sit_cit_typ,new_typ,new_sit where ((id_ntype>=2 and news.id_news=new_cit.id_news and new_cit.id_city=sit_cit_typ.id_city and sit_cit_typ.id_site=$id_site and news.id_news=new_typ.id_news and new_typ.id_type=sit_cit_typ.id_type) or (id_ntype=1 and news.id_news=new_sit.id_news and new_sit.id_site=$id_site)) and $sortcol between '$dt_ownb' and '$dt_owne' and approved=$approved order by $order"; } else { $query="select distinct news.id_news from news,new_cit,sit_cit_typ,new_typ,new_sit where (((id_ntype=$id_comntype or (id_ntype>=2 and news.id_news=new_cit.id_news and new_cit.id_city=sit_cit_typ.id_city)) and sit_cit_typ.id_site=$id_site and news.id_news=new_typ.id_news and new_typ.id_type=sit_cit_typ.id_type) or (id_ntype=1 and news.id_news=new_sit.id_news and new_sit.id_site=$id_site)) and $sortcol between '$dt_ownb' and '$dt_owne' and approved=$approved order by $order"; } } } /* // version with ussr news on every page and without site news $query="select distinct news.id_news from news,new_cit,sit_cit_typ,new_typ where ((id_ntype=$id_comntype or (id_ntype>=2 and news.id_news=new_cit.id_news and new_cit.id_city=sit_cit_typ.id_city)) and sit_cit_typ.id_site=$id_site and news.id_news=new_typ.id_news and new_typ.id_type=sit_cit_typ.id_type) and $sortcol between '$dt_ownb' and '$dt_owne' order by $order"; */ $q=mysql_query($query,$cid); $found=mysql_numrows($q); $showpage=1; $showtotal=ceil((double)$found/$showby); if(isset($id_news_list)) { unset($id_news_list); } for($i=0; $i<$found; $i++) { $r=mysql_fetch_array($q); $id_news_list[$i]=$r['id_news']; } // print("

Найдено: ".$found."

\n"); } if($showtotal>0) { if(isset($news)) { $id_news_list=unserialize(StripSlashes(urldecode($news))); } elseif(!isset($id_news_list)) { tail(); } $id_news_this='('.implode(',',array_slice($id_news_list,$showby*($showpage-1),$showby)).')'; $query="select distinct approved, news.id_news idnews,title,body,news.id_ntype idntype,DATE_FORMAT(news.dt_own,'%d %m %Y') d_own,DATE_FORMAT(news.dt_post,'%d.%m.%Y %k:%i') d_post,persons.nickname auth_name, news.id_author id_auth, news.id_editor id_edit, source from news,persons where news.id_news in $id_news_this and persons.id_person=news.id_author and approved=$approved order by $order"; $q=mysql_query($query,$cid); $dateo=date("m Y",mktime(0,0,0,substr($newsdate,4,2),1,substr($newsdate,0,4))); hd1(ru_month(substr($dateo,0,2),'I').substr($dateo,2,5)); for($i=0; $i \n"); /* print(""); */ if(empty($r['source'])) { ?> \n\n"); } */ ?>
Информация: ".$r['auth_name']."
(Прислал: )
=3) { ?>
Редактировать
Удалить
'.preg_replace("/(_pic\((\d{1,20})\))/e", "pic2html(\\2,$maxW,$maxH)", str_replace("\r\n\r\n","

\n

",$r['body']))."

\n"); /* if($access_rate>=3) { print('
'); print('Редактировать'); print(""); print('Удалить'); print("
 
\n"); print("

Страница: \n"); $news=urlencode(serialize($id_news_list)); for($i=1; $i<=$showtotal; $i++) if($i!=$showpage) { print(''.$i."\n"); } else { print($i." "); } print("

"); } else { // print("
\n"); // commented out since every news is in separate table ?>

Новостей за указанный период не обнаружено.


=3) { ?> Добавить новость =2) { ?> Прочитать новости другого сайта