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()
75 if (!isset($_SESSION['uid']))
78 $query = sprintf("SELECT zeitung,name,counter FROM hits " .
79 "INNER JOIN zeitungen ON id = zeitung " .
80 "WHERE deleted IS false AND uid = %d " .
81 "ORDER BY counter DESC LIMIT 10", $_SESSION['uid']);
83 $sth = db_query($query) or carp("info_topten");
85 if (pg_num_rows ($sth) == 0)
88 $ret = '<h3>Favoriten</h3>';
90 for ($n=0; $n < pg_num_rows ($sth); $n++) {
91 $row = pg_fetch_array ($sth, $n);
92 $ret .= sprintf('<li><a href="%szeitung/%d.html">%s</a></li>',
93 $cfg['basepath'], $row['zeitung'], $row['name']);
105 if (!isset($zlist['zid']))
108 $query = sprintf("SELECT id,tagname,count(uid) AS count " .
109 "FROM tags JOIN zeitung_tags ON tag = id " .
110 "WHERE zeitung = %d GROUP BY id,tagname " .
111 "ORDER BY lower(tagname)",
114 $sth = db_query($query);
116 if (pg_num_rows ($sth) == 0)
119 $ret = '<h3>Tags</h3>';
120 $ret .= '<p class="tagcloud">';
121 for ($n=0; $n < pg_num_rows ($sth); $n++) {
122 $row = pg_fetch_array ($sth, $n);
124 $ret .= sprintf('<span class="tag%d"><a href="%stag/%s.html">%s</a></span> ',
125 tag_class($row['count']), $cfg['basepath'],
126 urlencode($row['tagname']), $row['tagname']);
133 function info_tagcloud()
138 if (!isset($zlist['zid']))
141 if (!is_numeric($_SESSION['uid']))
144 $query = sprintf("SELECT id,tagname FROM tags " .
145 "JOIN zeitung_tags ON tag = id " .
146 "WHERE zeitung = %d AND uid = %d " .
147 "ORDER BY lower(tagname)",
148 $zlist['zid'], $_SESSION['uid']);
150 $sth = db_query($query);
152 if (pg_num_rows ($sth) == 0)
155 $ret = '<h3>Persönliche Tags</h3>';
156 $ret .= '<p class="tagcloud">';
157 for ($n=0; $n < pg_num_rows ($sth); $n++) {
158 $row = pg_fetch_array ($sth, $n);
160 $ret .= sprintf('<span class="tag0"><a href="%stag/%s.html">%s</a></span> ',
162 $row['tagname'], $row['tagname']);
169 function info_archive($zid)
173 $query = sprintf('SELECT count(*) FROM topics '.
174 'WHERE zeitung = %d AND archived IS true',
177 $sth = db_query($query);
179 $row = pg_fetch_array($sth, 0);
182 return sprintf('<img src="%sarchive.gif" width="27" height="20" alt=""> ' .
183 '<a href="%sarchiv/%d.html"><strong>Archiv</strong></a>',
184 $cfg['basepath'], $cfg['basepath'], $zid);
189 function info_actions()
194 $title = array('edit' => 'Stammdaten dieser Zeitung bearbeiten',
195 'tags' => 'Persönliche Tags zur Zeitung hinzufügen oder löschen',
196 'add' => 'Neue Zeitung oder Magazin aufnehmen',
197 'newtopic' => 'Neue Diskussion zu dieser Zeitung beginnen',
198 'bookmark' => 'Lesezeichen zu dieser Zeitung setzen',
199 'bookmarks' => 'Persönliche Lesezeichen verwalten',
205 if (isset($_SESSION['uid']) && $cfg['path'] == 'options.html')
206 $actions[] = sprintf('<img src="%spasswd.gif" width="27" height="23" alt=""> ' .
207 '<a href="%spasswd.html"><strong>Passwort ändern</strong></a>',
208 $cfg['basepath'], $cfg['basepath']);
210 if (($cfg['dir'] == 'zeitung' || $cfg['dir'] == 'archiv' || $cfg['dir'] == 'topic' ) &&
211 isset($zlist['zid'])) {
212 if (isset($_SESSION['uid']))
213 $actions[] = sprintf('<img src="%stag.gif" width="27" height="25" alt=""> ' .
214 '<a href="%stags.html?zeitung=%d" title="%s"><strong>Tags verwalten</strong></a>',
215 $cfg['basepath'], $cfg['basepath'], $zlist['zid'],
218 $actions[] = sprintf('<img src="%stag.gif" width="27" height="25" alt=""> ' .
219 '<a href="%slogin.html?from=tags" title="%s"><strong>Tags verwalten</strong></a>',
220 $cfg['basepath'], $cfg['basepath'], $title['tags']);
223 if ($cfg['dir'] == 'zeitung' && isset($_SESSION['uid'])) {
224 if (javascript_ok()) {
226 $ret .= load_javascript('bookmarks.js');
227 $link = sprintf('href="%sbookmark.html" onclick="return bookmark_action(\'add\',%d);"',
228 $cfg['basepath'], $zlist['zid']);
230 $link = sprintf('href="%sbookmark.html?zeitung=%d"', $cfg['basepath'], $zlist['zid']);
232 $actions[] = sprintf('<img src="%sadd.gif" width="27" height="24" alt=""> ' .
233 '<a %s title="%s"><strong>Lesezeichen setzen</strong></a>',
234 $cfg['basepath'], $link,
238 if ($cfg['path'] == 'options.html' && isset($_SESSION['uid']))
239 $actions[] = sprintf('<img src="%sbookmarks.gif" width="27" height="21" alt=""> ' .
240 '<a href="%sbookmark.html" title="%s"><strong>Lesezeichen verwalten</strong></a>',
241 $cfg['basepath'], $cfg['basepath'],
242 $title['bookmarks']);
244 if ($cfg['dir'] == 'zeitung' && isset($zlist['zid'])) {
245 if (isset($_SESSION['uid']))
246 $actions[] = sprintf('<img src="%sedit.gif" width="27" height="26" alt=""> ' .
247 '<a href="%sedit.html?zeitung=%d" title="%s"><strong>Bearbeiten</strong></a>',
248 $cfg['basepath'], $cfg['basepath'], $zlist['zid'],
251 $actions[] = sprintf('<img src="%sedit.gif" width="27" height="26" alt=""> ' .
252 '<a href="%slogin.html?from=edit" title="%s"><strong>Bearbeiten</strong></a>',
253 $cfg['basepath'], $cfg['basepath'],
257 if ($zlist['page'] == 'index' ||
258 $cfg['dir'] == 'zeitung' ||
259 $cfg['dir'] == 'tag') {
260 if (isset($_SESSION['uid']))
261 $actions[] = sprintf('<img src="%snewspaper.gif" width="27" height="25" alt=""> ' .
262 '<a href="%snew.html" title="%s"><strong>Neue Zeitung</strong></a>',
263 $cfg['basepath'], $cfg['basepath'], $title['add']);
265 $actions[] = sprintf('<img src="%snewspaper.gif" width="27" height="25" alt=""> ' .
266 '<a href="%slogin.html?from=new" title="%s"><strong>Neue Zeitung</strong></a>',
267 $cfg['basepath'], $cfg['basepath'], $title['add']);
270 if ($zlist['notopic'] === true)
271 $text = 'Diskussion';
273 $text = 'Neues Thema';
275 if (($cfg['dir'] == 'zeitung' || $cfg['dir'] == 'archiv') && isset($zlist['zid'])) {
276 if (isset($_SESSION['uid']))
277 $actions[] = sprintf('<img src="%snewtopic.gif" width="27" height="20" alt=""> ' .
278 '<a href="%stopic.html?zeitung=%d" title="%s"><strong>%s</strong></a>',
279 $cfg['basepath'], $cfg['basepath'], $zlist['zid'],
280 $title['newtopic'], $text);
282 $actions[] = sprintf('<img src="%snewtopic.gif" width="27" height="20" alt=""> ' .
283 '<a href="%slogin.html?from=zeitung" title="%s"><strong>%s</strong></a>',
284 $cfg['basepath'], $cfg['basepath'], $title['newtopic'], $text);
287 if ($cfg['dir'] == 'zeitung' && isset($zlist['zid'])) {
288 $try = info_archive($zlist['zid']);
294 $ret .= '<p><ul class="action">';
295 foreach ($actions as $row)
296 $ret .= '<li>' . $row . '</li>';
303 function info_bookmarks()
307 if (!isset($_SESSION['uid']))
310 if ($cfg['path'] == 'bookmark.html')
313 $try = format_info_bookmarks();
318 $ret = '<h3>Lesezeichen</h3>';
319 $ret .= '<div id="bookmarks">';