config.php introduced
[www.energie.vellum.cz.git] / obsah.php
1 <?php $cvs_id='$Id$';
2
3         include("common.php");
4
5         /* assign it manually to force it to value "0" if it would be unset */
6         $year =prepvar("year" ,"[0-9]+",false/*required*/);
7         $month=prepvar("month","[0-9]+",false/*required*/);
8
9         if ($month && !$year)
10                 $month=0;
11
12              if (!$year)
13                 $title_tail="Obsahy v¹ech èísel";
14         else if (!$month)
15                 $title_tail="Obsahy èísel roku $year";
16         else
17                 $title_tail="Obsah èísla $year/".month_full($year,$month);
18
19         $head_css="
20 .page { font-style: italic; }
21 ";
22         heading();
23         print("<h1>$title_tail</h1>\n");
24
25         db_connect();
26         $result=db_query("select year,month,month_last,contents from $tb_obsah"
27                         .($year  ? " where year='$year'"   : "")
28                         .($month ?   " and month='$month'" : "")
29                         ." order by year,month"
30                         );
31         if (!mysql_num_rows($result))
32                 fatal("Obsah po¾adovan".($month ? "ého èísla" : "ých èísel")." bohu¾el není ulo¾en");
33         while ($row=mysql_fetch_array($result)) {
34                 if (!$month)
35                         print("<h2>Èíslo ".$row["year"]."/".month_full($row["year"],$row["month"],$row["month_last"])."</h2>\n");
36                 $contents=$sep_obsah_contents.$row["contents"];
37                 $contents=ereg_replace("http://[^[:space:]$page_obsah_contents$sep_obsah_contents]+",
38                                 "<a href=\"\\0\">\\0</a>",$contents);
39                 $contents=ereg_replace("$page_obsah_contents([^$sep_obsah_contents]+)",
40                                 "<br /><div class=\"page\">strana ... \\1</div>",$contents);
41                 $contents=ereg_replace("\n","<br />\n\t\t",$contents);
42                 $contents=ereg_replace("$sep_obsah_contents([^$sep_obsah_contents]*)","\t<li>\\1</li>\n",$contents);
43                 print("<ul>\n$contents</ul>\n");
44                 }
45         mysql_free_result($result);
46
47         footer();
48 ?>