3 function info_searchform()
8 $replace = array('basepath' => $cfg['basepath'],
9 'keyword' => $zlist['keyword']);
11 return load_javascript('searchform.js') . load_template('searchform.html', $replace);
18 if ($cfg['path'] == 'reply.html' ||
19 $cfg['path'] == 'topic.html' ||
20 $cfg['path'] == 'new.html' ||
21 $cfg['dir'] == 'zeitung')
24 $query = "SELECT name,id FROM zeitungen " .
25 "WHERE changed > now() - interval '3 months' AND deleted IS false " .
26 "ORDER BY changed DESC limit 10";
28 $sth = db_query($query);
30 if (pg_num_rows ($sth) == 0)
33 $ret = '<h3>Neu aufgenommen</h3>';
35 for ($n=0; $n < pg_num_rows ($sth); $n++) {
36 $row = pg_fetch_array ($sth, $n);
37 $ret .= sprintf('<li><a href="%szeitung/%d.html">%s</a></li>',
38 $cfg['basepath'], $row['id'], $row['name']);
45 function info_topten()
49 $query = "SELECT zeitung,name,sum(counter) as counter FROM hits " .
50 "INNER JOIN zeitungen ON id = zeitung " .
51 "WHERE deleted IS false " .
52 "GROUP BY zeitung,name ORDER BY counter DESC LIMIT 10";
54 $sth = db_query($query) or carp("info_topten");
56 if (pg_num_rows ($sth) == 0)
59 $ret = '<h3>Top 10</h3>';
61 for ($n=0; $n < pg_num_rows ($sth); $n++) {
62 $row = pg_fetch_array ($sth, $n);
63 $ret .= sprintf('<li><a href="%szeitung/%d.html">%s</a></li>',
64 $cfg['basepath'], $row['zeitung'], $row['name']);
71 function info_hitlist()
76 if (!isset($_SESSION['uid']))
79 $query = sprintf("SELECT zeitung,name,counter FROM hits " .
80 "INNER JOIN zeitungen ON id = zeitung " .
81 "WHERE deleted IS false AND uid = %d " .
82 "ORDER BY counter DESC LIMIT 10", $_SESSION['uid']);
84 $sth = db_query($query) or carp("info_topten");
86 if (pg_num_rows ($sth) == 0)
89 $ret = '<h3>Favoriten</h3>';
91 for ($n=0; $n < pg_num_rows ($sth); $n++) {
92 $row = pg_fetch_array ($sth, $n);
93 $ret .= sprintf('<li><a href="%szeitung/%d.html">%s</a></li>',
94 $cfg['basepath'], $row['zeitung'], $row['name']);
106 if (!isset($zlist['zid']))
109 $query = sprintf("SELECT id,tagname,count(uid) AS count " .
110 "FROM tags JOIN zeitung_tags ON tag = id " .
111 "WHERE zeitung = %d GROUP BY id,tagname " .
112 "ORDER BY lower(tagname)",
115 $sth = db_query($query);
117 if (pg_num_rows ($sth) == 0)
120 $ret = '<h3>Tags</h3>';
121 $ret .= '<p class="tagcloud">';
122 for ($n=0; $n < pg_num_rows ($sth); $n++) {
123 $row = pg_fetch_array ($sth, $n);
125 $ret .= sprintf('<span class="tag%d"><a href="%stag/%s.html">%s</a></span> ',
126 tag_class($row['count']), $cfg['basepath'],
127 urlencode($row['tagname']), $row['tagname']);
134 function info_tagcloud()
140 if (!isset($zlist['zid']))
143 if (!is_numeric($_SESSION['uid']))
146 $query = sprintf("SELECT id,tagname FROM tags " .
147 "JOIN zeitung_tags ON tag = id " .
148 "WHERE zeitung = %d AND uid = %d " .
149 "ORDER BY lower(tagname)",
150 $zlist['zid'], $_SESSION['uid']);
152 $sth = db_query($query);
154 if (pg_num_rows ($sth) == 0)
157 $ret = '<h3>Persönliche Tags</h3>';
158 $ret .= '<p class="tagcloud">';
159 for ($n=0; $n < pg_num_rows ($sth); $n++) {
160 $row = pg_fetch_array ($sth, $n);
162 $ret .= sprintf('<span class="tag0"><a href="%stag/%s.html">%s</a></span> ',
164 $row['tagname'], $row['tagname']);
171 function info_archive($zid)
175 $query = sprintf('SELECT count(*) FROM topics '.
176 'WHERE zeitung = %d AND archived IS true',
179 $sth = db_query($query);
181 $row = pg_fetch_array($sth, 0);
184 return sprintf('<img src="%sarchive.gif" width="27" height="20" alt=""> ' .
185 '<a href="%sarchiv/%d.html"><strong>Archiv</strong></a>',
186 $cfg['basepath'], $cfg['basepath'], $zid);
191 function info_actions()
197 $title = array('edit' => 'Stammdaten dieser Zeitung bearbeiten',
198 'tags' => 'Persönliche Tags zur Zeitung hinzufügen oder löschen',
199 'add' => 'Neue Zeitung oder Magazin aufnehmen',
200 'newtopic' => 'Neue Diskussion zu dieser Zeitung beginnen',
201 'bookmark' => 'Lesezeichen zu dieser Zeitung setzen',
202 'bookmarks' => 'Persönliche Lesezeichen verwalten',
208 if (isset($_SESSION['uid']) && $cfg['path'] == 'options.html')
209 $actions[] = sprintf('<img src="%spasswd.gif" width="27" height="23" alt=""> ' .
210 '<a href="%spasswd.html"><strong>Passwort ändern</strong></a>',
211 $cfg['basepath'], $cfg['basepath']);
213 if (($cfg['dir'] == 'zeitung' || $cfg['dir'] == 'archiv' || $cfg['dir'] == 'topic' ) &&
214 isset($zlist['zid'])) {
215 if (isset($_SESSION['uid']))
216 $actions[] = sprintf('<img src="%stag.gif" width="27" height="25" alt=""> ' .
217 '<a href="%stags.html?zeitung=%d" title="%s"><strong>Tags verwalten</strong></a>',
218 $cfg['basepath'], $cfg['basepath'], $zlist['zid'],
221 $actions[] = sprintf('<img src="%stag.gif" width="27" height="25" alt=""> ' .
222 '<a href="%slogin.html?from=tags" title="%s"><strong>Tags verwalten</strong></a>',
223 $cfg['basepath'], $cfg['basepath'], $title['tags']);
226 if ($cfg['dir'] == 'zeitung' && isset($_SESSION['uid'])) {
227 if (javascript_ok()) {
229 $ret .= load_javascript('bookmarks.js');
230 $link = sprintf('href="%sbookmark.html" onclick="return bookmark_action(\'add\',%d);"',
231 $cfg['basepath'], $zlist['zid']);
233 $link = sprintf('href="%sbookmark.html?zeitung=%d"', $cfg['basepath'], $zlist['zid']);
235 $actions[] = sprintf('<img src="%sadd.gif" width="27" height="24" alt=""> ' .
236 '<a %s title="%s"><strong>Lesezeichen setzen</strong></a>',
237 $cfg['basepath'], $link,
241 if ($cfg['path'] == 'options.html' && isset($_SESSION['uid']))
242 $actions[] = sprintf('<img src="%sbookmarks.gif" width="27" height="21" alt=""> ' .
243 '<a href="%sbookmark.html" title="%s"><strong>Lesezeichen verwalten</strong></a>',
244 $cfg['basepath'], $cfg['basepath'],
245 $title['bookmarks']);
247 if ($cfg['dir'] == 'zeitung' && isset($zlist['zid'])) {
248 if (isset($_SESSION['uid']))
249 $actions[] = sprintf('<img src="%sedit.gif" width="27" height="26" alt=""> ' .
250 '<a href="%sedit.html?zeitung=%d" title="%s"><strong>Bearbeiten</strong></a>',
251 $cfg['basepath'], $cfg['basepath'], $zlist['zid'],
254 $actions[] = sprintf('<img src="%sedit.gif" width="27" height="26" alt=""> ' .
255 '<a href="%slogin.html?from=edit" title="%s"><strong>Bearbeiten</strong></a>',
256 $cfg['basepath'], $cfg['basepath'],
260 if ($zlist['page'] == 'index' ||
261 $cfg['dir'] == 'zeitung' ||
262 $cfg['dir'] == 'tag') {
263 if (isset($_SESSION['uid']))
264 $actions[] = sprintf('<img src="%snewspaper.gif" width="27" height="25" alt=""> ' .
265 '<a href="%snew.html" title="%s"><strong>Neue Zeitung</strong></a>',
266 $cfg['basepath'], $cfg['basepath'], $title['add']);
268 $actions[] = sprintf('<img src="%snewspaper.gif" width="27" height="25" alt=""> ' .
269 '<a href="%slogin.html?from=new" title="%s"><strong>Neue Zeitung</strong></a>',
270 $cfg['basepath'], $cfg['basepath'], $title['add']);
273 if ($zlist['notopic'] === true)
274 $text = 'Diskussion';
276 $text = 'Neues Thema';
278 if (($cfg['dir'] == 'zeitung' || $cfg['dir'] == 'archiv') && isset($zlist['zid'])) {
279 if (isset($_SESSION['uid']))
280 $actions[] = sprintf('<img src="%snewtopic.gif" width="27" height="20" alt=""> ' .
281 '<a href="%stopic.html?zeitung=%d" title="%s"><strong>%s</strong></a>',
282 $cfg['basepath'], $cfg['basepath'], $zlist['zid'],
283 $title['newtopic'], $text);
285 $actions[] = sprintf('<img src="%snewtopic.gif" width="27" height="20" alt=""> ' .
286 '<a href="%slogin.html?from=zeitung" title="%s"><strong>%s</strong></a>',
287 $cfg['basepath'], $cfg['basepath'], $title['newtopic'], $text);
290 if ($cfg['dir'] == 'zeitung' && isset($zlist['zid'])) {
291 $try = info_archive($zlist['zid']);
297 $ret .= '<p><ul class="action">';
298 foreach ($actions as $row)
299 $ret .= '<li>' . $row . '</li>';
306 function info_bookmarks()
311 if (!isset($_SESSION['uid']))
314 if ($cfg['path'] == 'bookmark.html')
317 $try = format_info_bookmarks();
322 $ret = '<h3>Lesezeichen</h3>';
323 $ret .= '<div id="bookmarks">';