Add configuration to display data protection statement
[infodrom.org/www.zeitungsliste.de] / lib / functions.inc
index 5b6c020..19c83c8 100644 (file)
@@ -27,6 +27,7 @@ $pages = array('logout.html' => array('lib' => 'login.inc',
                                   'func' => 'process_new'),
               'bookmark.html' => array('lib' => 'bookmarks.inc',
                                        'func' => 'process_bookmark'),
+              'datenschutz.html' => array('func' => 'show_datenschutz'),
               'contact.html' => array('func' => 'process_contact'),
               'sitemap.html' => array('lib' => 'layout.inc',
                                       'func' => 'layout_sitemap'),
@@ -36,6 +37,8 @@ $dirs = array('zeitung' => array('func' => 'layout_showpaper'),
              'archiv' => array('func' => 'layout_archive'),
              'tag' => array('func' => 'layout_showtag'),
              'topic' => array('func' => 'layout_topic'),
+             'admin' => array('lib' => 'admin.inc',
+                              'func' => 'layout_admin'),
              );
 
 
@@ -52,8 +55,6 @@ function carp($msg)
 
 function userstatus()
 {
-  global $_SESSION;
-
   if (isset($_SESSION['uid']))
     $info = array($_SESSION['online'], $_SESSION['users'], $_SESSION['zeitungen'],
                  $_SESSION['ztags'], $_SESSION['tags']);
@@ -67,10 +68,6 @@ function userstatus()
 function dispatch()
 {
   global $cfg;
-  global $_SERVER;
-  global $_SESSION;
-  global $_GET;
-  global $_POST;
   global $zlist;
   global $pages;
   global $dirs;
@@ -107,6 +104,13 @@ function dispatch()
   return layout_page($body);
 }
 
+function show_datenschutz()
+{
+  $body = load_template('datenschutz.html');
+
+  return $body;
+}
+
 function tagcloud_min()
 {
   $query = 'SELECT count(uid) AS count FROM zeitung_tags GROUP BY zeitung,tag ORDER BY count ASC LIMIT 1';
@@ -141,8 +145,6 @@ function tagcloud_max()
 
 function tag_class($count)
 {
-  global $_SESSION;
-
   if (isset($_SESSION['uid'])) {
     if (!isset($_SESSION['tagcloud_lastupdate']) ||
        $_SESSION["tagcloud_lastupdate"] < time() - 60*60*12) {
@@ -245,12 +247,17 @@ function format_newspaper($id)
   $row = pg_fetch_array ($sth, 0);
 
   $ret = '<div class="newspaper">';
-  $ret .= sprintf('<h3>%s</h3>', htmlspecialchars($row['name']));
-  $zlist['newspaper'] = htmlspecialchars($row['name']);
+  $ret .= sprintf('<h3>%s</h3>', $row['name']);
+  $zlist['newspaper'] = $row['name'];
+  $zlist['city'] = $row['city'];
 
   $ret .= sprintf('<p>%s<br>Ort: %s<br>URL: <a href="%s"><code>%s</code></a></p>',
                  $row['description'], $row['city'],
                  $row['url'], $row['url']);
+
+  $ret .= sprintf('<div class="link"><a href="%s">Zur Homepage</a></div>',
+                 $row['url']);
+
   $ret .= '</div>';
 
   return $ret;
@@ -292,7 +299,6 @@ function format_topic($topic)
 {
   global $cfg;
   global $zlist;
-  global $_SERVER;
 
   $query = sprintf("SELECT topic,archived,zeitung FROM topics WHERE id = %d",
                   $topic);
@@ -434,8 +440,6 @@ function is_valid_url($url) {
 
 function ajax_check_url()
 {
-  global $POST;
-
   if (!empty($_POST['url']) && is_valid_url($_POST['url']))
     return true;
 
@@ -473,8 +477,6 @@ function sendmail($to, $name, $subject, $body, $header=array())
 
 function logbook($table,$refid,$column,$old,$new)
 {
-  global $_SESSION;
-
   $query = sprintf("INSERT INTO logbook (uid,tab,refid,col,oldval,newval,modified) " .
                   "VALUES (%d,'%s',%d,'%s','%s','%s',now())",
                   $_SESSION['uid'], $table,$refid,$column,
@@ -487,7 +489,6 @@ function logbook($table,$refid,$column,$old,$new)
 function hits_inc($zeitung)
 {
   global $cfg;
-  global $_SESSION;
 
   if (is_spider())
     return;
@@ -507,5 +508,3 @@ function hits_inc($zeitung)
 
   db_query($query);
 }
-
-?>