// !!! UWAGA !!!
// Aby to dobrze dzialalo, trzeba do przep dodac przynajmniej jeden rekord
// $wid
// $nid
// $no_comments -- nie sa pokazywane komentarze (wazne przy podgladzie z admina)
if(!$docroot)
require_once "../conf.php";
require_once "$comdocroot/common/common.inc";
require_once "$comdocroot/common/links_ops.php";
require_once "$comdocroot/common/files_ops.php";
if ($nfid)
{
$nfid=dbesc($nfid);
$res = query ("select zdjecie from newsy_fotki where nfid='$nfid'");
if ($res)
{
$ob = mysql_fetch_object ( $res );
header ("Content-Type: image/jpeg");
print ("$ob->zdjecie");
return;
}
}
if ($nfid_big)
{
$nfid_big=dbesc($nfid_big);
$res = query ("select zdjecie_big from newsy_fotki where nfid='$nfid_big'");
if ($res)
{
$ob = mysql_fetch_object ( $res );
header ("Content-Type: image/jpeg");
print ("$ob->zdjecie_big");
return;
}
}
if ($fota)
{
$fota=dbesc($fota);
$res = query ("select zdjecie from newsy where nid='$fota'");
if ($res)
{
$ob = mysql_fetch_object ( $res );
header ("Content-Type: image/jpeg");
print ("$ob->zdjecie");
return;
}
}
if ($fota_big)
{
$fota_big=dbesc($fota_big);
$res = query ("select zdjecie_big from newsy where nid='$fota_big'");
if ($res)
{
$ob = mysql_fetch_object ( $res );
header ("Content-Type: image/jpeg");
print ("$ob->zdjecie_big");
return;
}
}
?>
if (!$newszoom) $newszoom = $PHP_SELF; /// tylko jeszcze trzeba do news.php wrzucic sensownie to co jest w news_powiekszenie.php
if (!$fotyview) $fotyview = "$comrelpath/common/news.php";
if (!$newsview) $newsview = "$comrelpath/common/news.php";
if (!$newslist) $newslist = $PHP_SELF;
if ($news)
{
$news=dbesc($news);
$res = query ("select nid, wid, fname as autor, newsy.tytul, tresc, zdjecie_tytul, zdjecie is not null as fota, zdjecie_big is not null as fota_big, data_wpr, data_start, data_end, wezel, email, tytul_tresci, zwiastun, wezly.tytul as wtytul, opis, flagi, prefix, options, layout_data_wpr, layout_tytul, layout_tresc, layout_foto, layout_autor, layout_comments from newsy, wezly, users" . " where wezel=wid and uid = autor and nid = '$news'".($podglad?"":" and widoczny = 1"));
$linki=links_list_by_obid("newsy", $news);
$pliki=files_list_by_obid("newsy", $news);
$rescomms=query("select * from newsy_comm where news='$news' order by ncid");
$comms=array();
while ($ob=mysql_fetch_object($rescomms))
{
$p=$ob;
$p->text=stripslashes($ob->text);
$p->nick=stripslashes($ob->nick);
array_push($comms,$p);
};
$resfotki=query("select nfid, news, fname, nazwa from newsy_fotki where news='$news' order by pozycja, nfid");
$fotki=array();
while($obf=mysql_fetch_object($resfotki))
array_push($fotki, $obf);
$prefix="news_main_full_";
if (mysql_num_rows($res))
{
$ob=mysql_fetch_object($res);
$ob->tytul = stripslashes($ob->tytul);
// by Wit: to ponizej jakies glupie, lepiej chyba wybrac sobie w layoucie
// $ob->tytul_tresci=stripslashes($ob->tytul_tresci ? $ob->tytul_tresci : $ob->tytul);
$ob->tytul_tresci=stripslashes($ob->tytul_tresci);
$ob->tresc=stripslashes($ob->tresc);
$ob->zwiastun=stripslashes($ob->zwiastun);
$ob->zdjecie_tytul=stripslashes($ob->zdjecie_tytul);
$lprefix=$ob->prefix;
if ($ob->fota)
{
$ob->fotka="$fotyview?fota=$ob->nid";
if($ob->fota_big)
{
$ob->fotka_big="$fotyview?fota_big=$ob->nid";
$ob->fotka_zoom="javascript:news_powiekszenie('$comrelpath/common/news_powiekszenie.php?nid=$ob->nid', '".htmlspecialchars($ob->zwiastun)."', 100, 100);";
}else
{
$ob->fotka_big="";
$ob->fotka_zoom="";
};
}else
{
$ob->fotka = "";
$ob->fotka_big="";
$ob->fotka_zoom="";
};
if($ob->data_wpr)
list($ob->data_wpr_rok, $ob->data_wpr_miesiac, $ob->data_wpr_dzien) = split ("-", $ob->data_wpr);
if($ob->data_start)
list($ob->data_start_rok, $ob->data_start_miesiac, $ob->data_start_dzien) = split ("-", $ob->data_start);
if($ob->data_end)
list($ob->data_end_rok, $ob->data_end_miesiac, $ob->data_end_dzien) = split ("-", $ob->data_end);
if($no_comments)
$ob->layout_comments=0;
// include "$docroot/layouts/$prefix${lprefix}layout.inc";
include find_include("layouts/$prefix${lprefix}layout.inc");
};
return;
} else
{
$prefix="news_main_list_";
if (!$wid)
{
$res = query("select wid, tytul, opis from wezly where www_show=1");
if ($lang=="english")
{
print "
Branch list
\n";
print "Entering news branches you'll see current events
\n";
}elseif ($lang=="polski")
{
print "Lista działów
\n";
print "Wchodząc do każdego działu zobaczysz aktualności w nim opublikowane.
\n";
}
print "\n";
$i=0;
while ($ob = mysql_fetch_object($res))
{
$wid = $ob->wid;
$tytul = $ob->tytul;
$wopis = $ob->opis;
$href = $newslist."?wid=".$wid;
print "- $tytul ";
if ($hrefoper)
print " Zarządzanie";
print "$wopis
\n";
$i=($i+1)%sizeof($class);
}
print"
\n";
return;
}
$wid = dbesc($wid);
$res = query("select * from wezly where wid='$wid'");
$wez = mysql_fetch_object($res);
$typ = $wez->flagi & 15;
$lprefix = $wez->prefix;
$options = $wez->options;
$wfiltr=$wez->wfiltr;
if(isset($forcecols))
$liczba_kolumn=$forcecols;
else
$liczba_kolumn=$wez->liczba_kolumn;
$przewijanie=$wez->przewijanie;
$ilosc_na_stronie=$wez->ilosc_na_stronie;
$filtr="";
if($wfiltr!=NULL)
$filtr="and filtr=$wfiltr";
/*
0 normalny, wszystkie wiadomosci nalezace do wezla
2 archiwum, wszystkie wiadomosci nalezace do wezla, juz nieaktualne, ze zwiastunem
3 hotnews, wszystkie wiadomosci nalezace do wezla, po jednej z kazdego zrodla
*/
switch ($typ)
{
case 0:
case 1:
$res = query("select nid, fname as autor, newsy.tytul, tresc, zdjecie is not null as fota, zdjecie_big is not null as fota_big, data_wpr, data_start, data_end, wezel, email, tytul_tresci, zwiastun ".
"from przep, newsy, users, wezly ".
"where widoczny = 1 and (wezel = '$wid' or (zrodlo = wezel and ( cel = '$wid' and przep.ttl <= newsy.ttl))) and uid = autor and wid = wezel and ".
"(data_start is null or data_start = \"0000-00-00\" or data_start <= date(now())) and (data_end is null or data_end = \"0000-00-00\" or data_end >= date(now())) group by nid order by priorytet desc, data_wpr desc, nid desc");
break;
case 2: $res = query("select nid, fname as autor, newsy.tytul, tresc, zdjecie is not null as fota, zdjecie_big is not null as fota_big, data_wpr, data_start, data_end, wezel, email, tytul_tresci, zwiastun ".
"from przep, newsy, users, wezly ".
"where widoczny = 1 and (wezel = '$wid' or (zrodlo = wezel and (cel = '$wid' and przep.ttl <= newsy.ttl))) and uid = autor and wid = wezel and ".
" (data_end is not null and data_end != \"0000-00-00\" and data_end <= date(now())) group by nid order by priorytet desc, data_wpr desc, nid desc");
break;
case 4:
case 3: $res = query("select nid, fname as autor, newsy.tytul, tresc, zdjecie is not null as fota, zdjecie_big is not null as fota_big, data_wpr, data_start, data_end, wezel, email, tytul_tresci, zwiastun ".
"from przep, newsy, users, wezly ".
"where widoczny = 1 and (wezel = '$wid' or (zrodlo = wezel and (cel = '$wid' and przep.ttl <= newsy.ttl))) and uid = autor and wid = wezel and ".
"(data_start is null or data_start = \"0000-00-00\" or data_start <= date(now())) and (data_end is null or data_end = \"0000-00-00\" or data_end >= date(now())) ".
"group by nid order by priorytet desc, data_wpr desc, nid desc");
break;
case 5:
$res = query("select nid, fname as autor, newsy.tytul, tresc, zdjecie is not null as fota, zdjecie_big is not null as fota_big, data_wpr, data_start, data_end, wezel, email, tytul_tresci, zwiastun ".
"from przep, newsy, users, wezly ".
"where widoczny = 1 and (wezel = '$wid' or (zrodlo = wezel and ( cel = '$wid' and przep.ttl <= newsy.ttl))) and uid = autor and wid = wezel and ".
"(data_start is null or data_start = \"0000-00-00\" or data_start <= date(now())) and (data_end is null or data_end = \"0000-00-00\" or data_end >= date(now())) group by nid order by priorytet desc, data_wpr desc, nid desc limit 2");
break;
}
}
$i=1;
$j=1;//licznik newsów
$ww = array();
$ile_newsow=mysql_num_rows($res);
if ($przewijanie && $ilosc_na_stronie!=0 && $ilosc_na_stronie<$ile_newsow)
{
$licznik = ceil($ile_newsow/$ilosc_na_stronie);
if (!$strona || ($strona-1)*$ilosc_na_stronie>=$ile_newsow) $strona=1;
if ($strona>1) mysql_data_seek($res, ($strona-1)*$ilosc_na_stronie);
}
while (($ob = mysql_fetch_object($res))&&($j<=$ilosc_na_stronie || $ilosc_na_stronie==0))
{
$j++;
$linki=links_list_by_obid("newsy", $ob->nid);
$pliki=files_list_by_obid("newsy", $ob->nid);
$rescomms=query("select * from newsy_comm where news='$ob->nid' order by ncid");
$comms=array();
while ($ob1=mysql_fetch_object($rescomms))
{
$p=$ob1;
$p->text=stripslashes($ob1->text);
$p->nick=stripslashes($ob1->nick);
array_push($comms,$p);
};
$resfotki=query("select nfid, news, fname, nazwa from newsy_fotki where news='$ob->nid' order by pozycja, nfid");
$fotki=array();
while($obf=mysql_fetch_object($resfotki))
array_push($fotki, $obf);
$ob->wid=$wez->wid;
$ob->wtytul=$wez->tytul;
$ob->opis=$wez->opis;
$ob->flagi=$wez->flagi;
$ob->prefix=$wez->prefix;
$ob->options=$wez->options;
$ob->layout_data_wpr=$wez->layout_data_wpr;
$ob->layout_tytul=$wez->layout_tytul;
$ob->layout_tresc=$wez->layout_tresc;
$ob->layout_foto=$wez->layout_foto;
$ob->layout_autor=$wez->layout_autor;
$ob->layout_comments=$wez->layout_comments;
$ob->ilosc_na_stronie=$wez->ilosc_na_stronie;
$ob->przewijanie=$wez->przewijanie;
$ob->tytul=stripslashes($ob->tytul);
$ob->zwiastun=stripslashes($ob->zwiastun);
$ob->tytul_tresci=stripslashes($ob->tytul_tresci);
$ob->tresc=stripslashes($ob->tresc);
switch ($lay_tresc)
{
case "0": // (zwiastun lub 100 znakow tresci jak nie ma zwiastuna) + wiecej
$ob->zwiastun = $ob->zwiastun ? $ob->zwiastun : ((strlen(strip_tags($ob->tresc))>100) ? substr(strip_tags($ob->tresc),0,100)."..." : strip_tags($ob->tresc));
$ob->zwiastun=strip_tags($ob->zwiastun);
$ob->wiecej = "nid&wid=$ob->wid\">»»»";
break;
case "1": // tresc
$ob->zwiastun = strip_tags($ob->tresc);
break;
case "2": // 100 znakow tresci + wiecej
$ob->zwiastun = (strlen(strip_tags($ob->tresc))>100) ? substr(strip_tags($ob->tresc),0,100)."..." : strip_tags($ob->tresc);
$ob->wiecej= "nid&wid=$ob->wid\">więcej";
break;
}
if ($ob->fota)
{
$ob->fotka="$fotyview?fota=$ob->nid";
if($ob->fota_big)
{
$ob->fotka_big="$fotyview?fota_big=$ob->nid";
$ob->fotka_zoom="javascript:news_powiekszenie('$comrelpath/common/news_powiekszenie.php?nid=$ob->nid', '".htmlspecialchars($ob->zwiastun)."', 100, 100);";
}else
{
$ob->fotka_big="";
$ob->fotka_zoom="";
};
}else
{
$ob->fotka = "";
$ob->fotka_big="";
$ob->fotka_zoom="";
};
$ob->link = "$newsview?news=$ob->nid&wid=$ob->wid";
if($ob->data_wpr)
list($ob->data_wpr_rok, $ob->data_wpr_miesiac,$ob->data_wpr_dzien) = split ("-", $ob->data_wpr);
if($ob->data_start)
list($ob->data_start_rok, $ob->data_start_miesiac,$ob->data_start_dzien) = split ("-", $ob->data_start);
if($ob->data_end)
list($ob->data_end_rok, $ob->data_end_miesiac,$ob->data_end_dzien) = split ("-", $ob->data_end);
if($no_comments)
$ob->layout_comments=0;
if (($typ!=3 && $typ!=4) || !in_array($ob->wezel, $ww))
{
// include "$docroot/layouts/$prefix${lprefix}layout.inc";
include find_include("layouts/$prefix${lprefix}layout.inc");
if ($typ==5 && ($i==1))
print "
";
$i++;
}
if ($typ==3||$typ==4)
array_push ($ww, $ob->wezel);
}
if ($przewijanie && $ilosc_na_stronie!=0 && $ilosc_na_stronie<$ile_newsow)
{
$a=($strona>4&&$licznik>6)?(($strona+3>=$licznik)?(($licznik-7>0)?($licznik-6):1):($strona-3)):1;
$b=($licznik>$a+6)?($a+6):$licznik;
print"| ";
if ($a>1)
echo "I< \n";
if ($strona >1) //DO wypisywania napisu PREV
echo "< \n";
for($i=$a; $i<=$b;$i++)
{
if($i==$strona)
echo "$i\n";
else
echo "$i\n";
}
if ($strona<$licznik) //DO wypisywania napisu NEXT
echo " >\n";
echo " z $licznik stron.\n";
print" |
";
}
unset($opis);
?>