+EaP 4/2010 (164)
[www.energie.vellum.cz.git] / obsah.php
index 46e4a34..4aa257e 100644 (file)
--- a/obsah.php
+++ b/obsah.php
        $head_css="
 .page { font-style: italic; }
 ";
-       heading();
+
+       // Prevent indexing of pages with multiple months of the content, any
+       // websearch robot should get indexed the right one specific page anyway.
+       heading(true/*title*/,($year && $month)/*indexme*/);
+
        print("<h1>$title_tail</h1>\n");
 
-       $result=db_query("select year,month,month_last,contents from $tb_obsah"
-                       .($year  ? " where year=$year"   : "")
-                       .($month ?   " and month=$month" : "")
+       $result=db_query("select year,month,month_last,contents from $tb_obsah where contents is not null"
+                       .($year  ? " and year=$year"   : "")
+                       .($month ? " and month=$month" : "")
                        ." order by year,month"
                        );
        if (!mysql_num_rows($result))
                        print("<h2>Èíslo ".$month_a["name_full"]."</h2>\n");
                        }
                $contents=$sep_obsah_contents.$row["contents"];
-               $contents=htmlspecialchars($contents);
 
                $article_result=db_query("select name,id from $tb_clanek"
                                ." where  year=".$row[ "year"]
                                .  " and month=".$row["month"]
                                );
                while ($article_row=mysql_fetch_array($article_result))
-                       $contents=ereg_replace("$sep_obsah_contents(".quotemeta($article_row["name"]).")$page_obsah_contents",
+                       $contents=ereg_replace("$sep_obsah_contents("
+                                                       .quotemeta(ereg_replace("\\|.*\$","",$article_row["name"]))
+                                                       .")([\n$page_obsah_contents])",
                                        "$sep_obsah_contents"
                                                        ."<a href=\"clanek.php?year=".$row["year"]."&amp;month=".$row["month"]."&amp;id=".$article_row["id"]."\">"
                                                        ."\\1</a>"
-                                       ."$page_obsah_contents",$contents);
+                                       ."\\2",$contents);
                mysql_free_result($article_result);
 
                $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$appendix_obsah_contents]+)",
-                               "<br /><div class=\"page\">strana ... \\1</div>",$contents);
+                               "<br /><span class=\"page\">strana ... \\1</span>",$contents);
                $contents=ereg_replace("\n","<br />\n\t\t",$contents);
                $contents=ereg_replace("$sep_obsah_contents([^$sep_obsah_contents$appendix_obsah_contents]*)","\t<li>\\1</li>\n",$contents);
                if (1<count($contents_a=split("$appendix_obsah_contents",$contents,2)))