config.php introduced
[www.energie.vellum.cz.git] / obsah.php
diff --git a/obsah.php b/obsah.php
new file mode 100644 (file)
index 0000000..4addde7
--- /dev/null
+++ b/obsah.php
@@ -0,0 +1,48 @@
+<?php $cvs_id='$Id$';
+
+       include("common.php");
+
+       /* assign it manually to force it to value "0" if it would be unset */
+       $year =prepvar("year" ,"[0-9]+",false/*required*/);
+       $month=prepvar("month","[0-9]+",false/*required*/);
+
+       if ($month && !$year)
+               $month=0;
+
+            if (!$year)
+               $title_tail="Obsahy v¹ech èísel";
+       else if (!$month)
+               $title_tail="Obsahy èísel roku $year";
+       else
+               $title_tail="Obsah èísla $year/".month_full($year,$month);
+
+       $head_css="
+.page { font-style: italic; }
+";
+       heading();
+       print("<h1>$title_tail</h1>\n");
+
+       db_connect();
+       $result=db_query("select year,month,month_last,contents from $tb_obsah"
+                       .($year  ? " where year='$year'"   : "")
+                       .($month ?   " and month='$month'" : "")
+                       ." order by year,month"
+                       );
+       if (!mysql_num_rows($result))
+               fatal("Obsah po¾adovan".($month ? "ého èísla" : "ých èísel")." bohu¾el není ulo¾en");
+       while ($row=mysql_fetch_array($result)) {
+               if (!$month)
+                       print("<h2>Èíslo ".$row["year"]."/".month_full($row["year"],$row["month"],$row["month_last"])."</h2>\n");
+               $contents=$sep_obsah_contents.$row["contents"];
+               $contents=ereg_replace("http://[^[:space:]$page_obsah_contents$sep_obsah_contents]+",
+                               "<a href=\"\\0\">\\0</a>",$contents);
+               $contents=ereg_replace("$page_obsah_contents([^$sep_obsah_contents]+)",
+                               "<br /><div class=\"page\">strana ... \\1</div>",$contents);
+               $contents=ereg_replace("\n","<br />\n\t\t",$contents);
+               $contents=ereg_replace("$sep_obsah_contents([^$sep_obsah_contents]*)","\t<li>\\1</li>\n",$contents);
+               print("<ul>\n$contents</ul>\n");
+               }
+       mysql_free_result($result);
+
+       footer();
+?>