"; //include("in.htm"); //include("anasoftorodovnice.htm"); $last_days_of_jesus = 90; $startN = 0; $startW = 0; $startKni = 0; $startKal = 0; $startNj = 0; $maxN = 4; $maxW = 4; $maxKni = 3; $maxKal = 3; $maxNj = 1; $out = array(); if(!$idw) $idw = 0; if(!$idn) $idn = 0; // $datum=date("j. ", $datum).$mesiace[$_SESSION["lang"]][date("m", $datum)-1].date(" Y", $datum); function check_datum($datum) { global $last_days_of_jesus; $month_now = date("n"); $year_now = date("Y"); $day_now = date("d"); $month_prev = mktime(0,0,0,$month_now,($day_now-$last_days_of_jesus),$year_now); if($datum > $month_prev) return 1; else return 0; } function data_news($result, $j, $i) { global $out; $IDnews=mysql_result($result, $j, 'IDnews'); $datum=mysql_result($result, $j, 'datum'); $datum=strtotime($datum); if(!check_datum($datum)) return 0; $out[$i]["type"] = "news"; $out[$i]["ID"] = $IDnews; $out[$i]["datum"] = $datum; return 1; } function data_webzin($result, $j, $i) { global $out; $IDclanok=mysql_result($result, $j, 'IDclanok'); $datum=mysql_result($result, $j, 'datum'); $datum=strtotime($datum); if(!check_datum($datum)) return 0; $out[$i]["type"] = "webzin"; $out[$i]["ID"] = $IDclanok; $out[$i]["datum"] = $datum; return 1; } function data_info($result, $j, $i) { global $out; $IDcentrum=mysql_result($result, $j, 'IDcentrum'); $datum=mysql_result($result, $j, 'datum'); $datum=strtotime($datum); if(!check_datum($datum)) return 0; $out[$i]["type"] = "info"; $out[$i]["ID"] = $IDcentrum; $out[$i]["datum"] = $datum; return 1; } function generate_x($strSQL, $i, $type) { global $idw, $idn; $result=mysql_query($strSQL); $numrow=mysql_num_rows($result); if($numrow < 1) return $i; $z = 0; if($type == "news") { for ($j = 0; $j < $numrow; $j++) { if(data_news($result, $j, $i)) $i++; } $idn = $i; } else if($type == "webzin") { for ($j = 0; $j < $numrow; $j++) { if(data_webzin($result, $j, $i)) $i++; } $idw = $i; } else if($type == "info") { for ($j = 0; $j < $numrow; $j++) { if(data_info($result, $j, $i)) $i++; } $idw = $i; } return $i; } function generate_content ($archive, $idn, $idw) { global $startN, $maxN; global $startW, $maxW; global $startNj, $maxNj; global $startKal, $maxKal; global $startKni, $maxKni; global $start; global $max; global $out; global $mesiace; global $idn, $idw; if(!$archive) { // kratke spravy $strSQL = "SELECT IDnews, datum FROM news WHERE titulka = 1 AND active = 1 AND ".$_SESSION["lang"]."=1 ORDER BY datum DESC LIMIT $startN, $maxN"; $i = 0; $i = generate_x($strSQL, $i, "news"); // webzin $strSQL = "SELECT IDclanok, datum FROM clanok WHERE active=1 AND main=1 ORDER BY datum DESC, IDclanok DESC LIMIT $startW, $maxW"; $i = generate_x($strSQL, $i, "webzin"); // kalendarka $sec = 1; $strSQL="SELECT * FROM centrum WHERE active=1 AND titulkaasp=1 AND sec=$sec ORDER BY datum DESC LIMIT $startKal, $maxKal"; $i = generate_x($strSQL, $i, "info"); // njuvinky $sec = 10; $strSQL="SELECT * FROM centrum WHERE active=1 AND titulkaasp=1 AND sec=$sec ORDER BY datum DESC LIMIT $startNj, $maxNj"; $i = generate_x($strSQL, $i, "info"); // kniznica $sec = 6; $strSQL="SELECT * FROM centrum WHERE active=1 AND titulkaasp=1 AND sec=$sec ORDER BY datum DESC LIMIT $startKni, $maxKni"; $i = generate_x($strSQL, $i, "info"); } else { $strSQL = "SELECT IDnews, datum FROM news WHERE ".$_SESSION["lang"]."=1 ORDER BY datum DESC LIMIT $idn, 4"; $i = 0; $i = generate_x($strSQL, $i, "news"); $strSQL = "SELECT IDclanok, datum FROM clanok WHERE main=1 ORDER BY datum DESC, IDclanok DESC LIMIT $idw, 4"; $i = generate_x($strSQL, $i, "webzin"); } $z = $out; foreach($z as $res){ $sortAux[] = $res['datum']; } array_multisort($sortAux, SORT_DESC, $z); $out = $z; for($x = 0; $x < $i; $x++) { $id = $out[$x]["ID"]; $datum = $out[$x]["datum"]; $datum = date("j. ", $datum).$mesiace[$_SESSION["lang"]][date("m", $datum)-1].date(" Y", $datum); echo "
"; //echo ""; switch($out[$x]["type"]) { case "news": $sekcia = "krátke správy"; $strSQL = "SELECT * FROM news WHERE IDnews = $id"; $result=mysql_query($strSQL); $numrow=mysql_num_rows($result); $news=mysql_result($result, 0, 'news'); $nadpis=mysql_result($result, 0, 'nadpis'); $perex=mysql_result($result, 0, 'perex'); if(!preg_match("/

/", $perex)) $perex=ereg_replace("\n", "

", $perex); if(strlen($news) > 3) echo "

"; if(strlen($nadpis) > 3) echo "

$nadpis

 $sekcia

"; // echo "$datum
"; if(strlen($news) > 3) echo ""; echo "

".$perex."

"; echo "

\n"; break; case "webzin": $sekcia = "webzin"; $strSQL = "SELECT * FROM clanok WHERE IDclanok = $id"; $result=mysql_query($strSQL); $numrow=mysql_num_rows($result); $nadpis=mysql_result($result, 0, 'nadpis'); $perex=mysql_result($result, 0, 'perex'); if(!preg_match("/

/", $perex)) $perex=ereg_replace("\n", "

", $perex); $rubrika=mysql_result($result, 0, 'rubrika'); if(strlen($nadpis) > 3) echo "

" . $nadpis. "

"; //echo " ($datum)

\n"; echo " $sekcia

\n"; if(strlen($perex)>0) echo "

$perex

"; break; case "info": $strSQL = "SELECT * FROM centrum WHERE IDcentrum = $id"; $result=mysql_query($strSQL); $numrow=mysql_num_rows($result); $nadpis=mysql_result($result, 0, 'nadpis'); $perex=mysql_result($result, 0, 'perex'); $sec=mysql_result($result, 0, 'sec'); if(!preg_match("/

/", $perex)) $perex=ereg_replace("\n", "

", $perex); switch($sec) { case "1": $sekcia = "kalendárka"; break; case "10": $sekcia = "ňjúvinky"; break; case "6": $sekcia = "knižnica"; break; default: break; } if(strlen($nadpis) > 3) echo "

" . $nadpis. "

"; echo " $sekcia

\n"; if(strlen($perex)>0) echo "

$perex

"; break; default: break; } echo "
"; } echo "
"; echo "archív krátke správy"; echo "
"; } if($archive == 1) { generate_content(1, $idn-1, $idw-1); } else generate_content(0, 0, 0); include("bot.php"); ?>