$cfg['basepath'], 'keyword' => $zlist['keyword']); return load_javascript('searchform.js') . load_template('searchform.html', $replace); } function info_new() { global $cfg; if ($cfg['path'] == 'reply.html' || $cfg['path'] == 'topic.html' || $cfg['path'] == 'new.html' || $cfg['dir'] == 'zeitung') return; $query = "SELECT name,id FROM zeitungen " . "WHERE changed > now() - interval '3 months' AND deleted IS false " . "ORDER BY changed DESC limit 10"; $sth = db_query($query); if (pg_num_rows ($sth) == 0) return; $ret = '

Neu aufgenommen

'; $ret .= '

'; return $ret; } function info_topten() { global $cfg; $query = "SELECT zeitung,name,sum(counter) as counter FROM hits " . "INNER JOIN zeitungen ON id = zeitung " . "WHERE deleted IS false " . "GROUP BY zeitung,name ORDER BY counter DESC LIMIT 10"; $sth = db_query($query) or carp("info_topten"); if (pg_num_rows ($sth) == 0) return; $ret = '

Top 10

'; $ret .= '

'; return $ret; } function info_hitlist() { global $cfg; global $_SESSION; if (!isset($_SESSION['uid'])) return info_topten(); $query = sprintf("SELECT zeitung,name,counter FROM hits " . "INNER JOIN zeitungen ON id = zeitung " . "WHERE deleted IS false AND uid = %d " . "ORDER BY counter DESC LIMIT 10", $_SESSION['uid']); $sth = db_query($query) or carp("info_topten"); if (pg_num_rows ($sth) == 0) return info_topten(); $ret = '

Favoriten

'; $ret .= '

'; return $ret; } function info_tags() { global $cfg; global $zlist; if (!isset($zlist['zid'])) return; $query = sprintf("SELECT id,tagname,count(uid) AS count " . "FROM tags JOIN zeitung_tags ON tag = id " . "WHERE zeitung = %d GROUP BY id,tagname " . "ORDER BY lower(tagname)", $zlist['zid']); $sth = db_query($query); if (pg_num_rows ($sth) == 0) return; $ret = '

Tags

'; $ret .= '

'; for ($n=0; $n < pg_num_rows ($sth); $n++) { $row = pg_fetch_array ($sth, $n); $ret .= sprintf('%s ', tag_class($row['count']), $cfg['basepath'], urlencode($row['tagname']), $row['tagname']); } $ret .= '

'; return $ret; } function info_tagcloud() { global $cfg; global $zlist; global $_SESSION; if (!isset($zlist['zid'])) return; if (!is_numeric($_SESSION['uid'])) return; $query = sprintf("SELECT id,tagname FROM tags " . "JOIN zeitung_tags ON tag = id " . "WHERE zeitung = %d AND uid = %d " . "ORDER BY lower(tagname)", $zlist['zid'], $_SESSION['uid']); $sth = db_query($query); if (pg_num_rows ($sth) == 0) return info_tags(); $ret = '

Persönliche Tags

'; $ret .= '

'; for ($n=0; $n < pg_num_rows ($sth); $n++) { $row = pg_fetch_array ($sth, $n); $ret .= sprintf('%s ', $cfg['basepath'], $row['tagname'], $row['tagname']); } $ret .= '

'; return $ret; } function info_archive($zid) { global $cfg; $query = sprintf('SELECT count(*) FROM topics '. 'WHERE zeitung = %d AND archived IS true', $zid); $sth = db_query($query); $row = pg_fetch_array($sth, 0); if ($row[0] > 0) return sprintf(' ' . 'Archiv', $cfg['basepath'], $cfg['basepath'], $zid); return false; } function info_actions() { global $cfg; global $zlist; global $_SESSION; $title = array('edit' => 'Stammdaten dieser Zeitung bearbeiten', 'tags' => 'Persönliche Tags zur Zeitung hinzufügen oder löschen', 'add' => 'Neue Zeitung oder Magazin aufnehmen', 'newtopic' => 'Neue Diskussion zu dieser Zeitung beginnen', 'bookmark' => 'Lesezeichen zu dieser Zeitung setzen', 'bookmarks' => 'Persönliche Lesezeichen verwalten', ); $actions = array(); $ret = ''; if (isset($_SESSION['uid']) && $cfg['path'] == 'options.html') $actions[] = sprintf(' ' . 'Passwort ändern', $cfg['basepath'], $cfg['basepath']); if (($cfg['dir'] == 'zeitung' || $cfg['dir'] == 'archiv' || $cfg['dir'] == 'topic' ) && isset($zlist['zid'])) { if (isset($_SESSION['uid'])) $actions[] = sprintf(' ' . 'Tags verwalten', $cfg['basepath'], $cfg['basepath'], $zlist['zid'], $title['tags']); else $actions[] = sprintf(' ' . 'Tags verwalten', $cfg['basepath'], $cfg['basepath'], $title['tags']); } if ($cfg['dir'] == 'zeitung' && isset($_SESSION['uid'])) { if (javascript_ok()) { $ret .= load_javascript('bookmarks.js'); $link = sprintf('href="%sbookmark.html" onclick="return bookmark_action(\'add\',%d);"', $cfg['basepath'], $zlist['zid']); } else $link = sprintf('href="%sbookmark.html?zeitung=%d"', $cfg['basepath'], $zlist['zid']); $actions[] = sprintf(' ' . 'Lesezeichen setzen', $cfg['basepath'], $link, $title['bookmark']); } if ($cfg['path'] == 'options.html' && isset($_SESSION['uid'])) $actions[] = sprintf(' ' . 'Lesezeichen verwalten', $cfg['basepath'], $cfg['basepath'], $title['bookmarks']); if ($cfg['dir'] == 'zeitung' && isset($zlist['zid'])) { if (isset($_SESSION['uid'])) $actions[] = sprintf(' ' . 'Bearbeiten', $cfg['basepath'], $cfg['basepath'], $zlist['zid'], $title['edit']); else $actions[] = sprintf(' ' . 'Bearbeiten', $cfg['basepath'], $cfg['basepath'], $title['edit']); } if ($zlist['page'] == 'index' || $cfg['dir'] == 'zeitung' || $cfg['dir'] == 'tag') { if (isset($_SESSION['uid'])) $actions[] = sprintf(' ' . 'Neue Zeitung', $cfg['basepath'], $cfg['basepath'], $title['add']); else $actions[] = sprintf(' ' . 'Neue Zeitung', $cfg['basepath'], $cfg['basepath'], $title['add']); } if ($zlist['notopic'] === true) $text = 'Diskussion'; else $text = 'Neues Thema'; if (($cfg['dir'] == 'zeitung' || $cfg['dir'] == 'archiv') && isset($zlist['zid'])) { if (isset($_SESSION['uid'])) $actions[] = sprintf(' ' . '%s', $cfg['basepath'], $cfg['basepath'], $zlist['zid'], $title['newtopic'], $text); else $actions[] = sprintf(' ' . '%s', $cfg['basepath'], $cfg['basepath'], $title['newtopic'], $text); } if ($cfg['dir'] == 'zeitung' && isset($zlist['zid'])) { $try = info_archive($zlist['zid']); if ($try !== false) $actions[] = $try; } if ($actions) { $ret .= '

'; } return $ret; } function info_bookmarks() { global $cfg; global $_SESSION; if (!isset($_SESSION['uid'])) return; if ($cfg['path'] == 'bookmark.html') return; $try = format_info_bookmarks(); if ($try === false) return; $ret = '

Lesezeichen

'; $ret .= '
'; $ret .= $try; $ret .= '
'; return $ret; } ?>