codestyle
[disclosr.git] / documents / template.inc.php
blob:a/documents/template.inc.php -> blob:b/documents/template.inc.php
--- a/documents/template.inc.php
+++ b/documents/template.inc.php
@@ -68,7 +68,8 @@
 
                             </p>
                             <ul class="nav">
-                                <li><a href="index.php">Home</a></li>
+                                <li><a href="agency.php">By Agency</a></li>
+                                <li><a href="date.php">By Date</a></li>
                                 <li><a href="disclogsList.php">List of Disclosure Logs</a></li>
                                 <li><a href="about.php">About</a></li>
 
@@ -89,7 +90,9 @@
             <footer>
                 <p>Not affiliated with or endorsed by any government agency.</p>
             </footer>
-            <script type="text/javascript">
+              <?php
+            if ($ENV != "DEV") {
+                echo "<script type='text/javascript'>
 
                 var _gaq = _gaq || [];
                 _gaq.push(['_setAccount', 'UA-12341040-4']);
@@ -106,7 +109,9 @@
                     s.parentNode.insertBefore(ga, s);
                 })();
 
-            </script>
+            </script>";
+            }
+            ?>
             <!-- Le javascript
             ================================================== -->
             <!-- Placed at the end of the document so the pages load faster -->
@@ -150,10 +155,10 @@
     $result = "";
     $result .= '<div itemscope itemtype="http://schema.org/Article">';
     $result .= '<h2> <span itemprop="datePublished">' . $row->value->date . "</span>: <span itemprop='name headline'>" . truncate($row->value->title, 120) . "</span>";
-    $result .= '(<span itemprop="author publisher creator">' . $idtoname[$row->value->agencyID] . '</span>)</h2>';
-    $result .= "<p itemprop='description articleBody text'> Title" . $row->value->title . "<br/>";
+    $result .= ' (<span itemprop="author publisher creator">' . $idtoname[$row->value->agencyID] . '</span>)</h2>';
+    $result .= "<p itemprop='description articleBody text'> Title: " . $row->value->title . "<br/>";
     if (isset($row->value->description)) {
-        $result .= str_replace("\n", "<br>", $row->value->description);
+        $result .= str_replace("\n", "<br>", preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "",trim($row->value->description)));
     }
     if (isset($row->value->notes)) {
         $result .= " <br>Note: " . $row->value->notes;
@@ -163,13 +168,13 @@
     if (isset($row->value->links)) {
         $result .= '<h3>Links/Documents</h3><ul itemprop="associatedMedia">';
         foreach ($row->value->links as $link) {
-            $result .= '<li itemscope itemtype="http://schema.org/MediaObject"><a href=' . $link . ' itemprop="url contentURL">' . urlencode($link) . "</a></li>";
+            $result .= '<li itemscope itemtype="http://schema.org/MediaObject"><a href=' . htmlspecialchars ($link) . ' itemprop="url contentURL">' . htmlspecialchars ( $link) . "</a></li>";
         }
 
         $result .= "</ul>";
     }
     $result .= "<small><A itemprop='url' href='" . $row->value->url . "'>View original source...</a> ID: " . strip_tags($row->value->docID) . "</small>";
-    $result .= "</div>";
+    $result .= "</div>\n";
     return $result;
 }