aktive Umfragen

Svenkan
Titel: aktive Umfragen
Version: 1.0
Beschreibung: Beschreibung: Durch diesen Hack kann man sich über einen Link auf der Index alle aktiven Umfragen an.
Autor: Svenkan
Demo: im Archiv
Getestet mit: WoltLab Burning Board Lite 1.0.0
Vorraussetzung: WoltLab Burning Board Lite 1.0.0

ACHTUNG! Für Schäden wird keine Verantwortung übernommen!

/edit: kleiner Fehler in der install.txt verbessert.
----


weiter zum Download
elecfuture
Du schreibst in deiner Installation:

Öffne die index.php und suche:

<a href="search.php?action=24h&sid=$session[hash]">aktive Themen der letzten 24h</a>

Leider gibt es bei mir diese Zeile nicht. Was ist los?


Danke Augenzwinkern


EDIT: selber gelöst index.php ist index.tpl

EDIT 02: Nach beendigung der install, öffnet sich die Suchfunktion aber ansonsten keine fehler.
Svenkan
Ähm...es öffnet sich die Suche, das muss auch so (wegen search.php?...). Augenzwinkern
elecfuture
Ja es öffnet die Suche, aber es werden keine Umfragen angezeigt. Gar nichts. Sollten mit dem Hack nicht die aktiven Umfragen angezeigt werden?!
Svenkan
Bei mir werden sie angezeigt....
elecfuture
Also ich habs jetzt hin bekommen. Aber nur durch probieren. schau dir deine Anleitung bitte nochmal an. Ein paar Programmzeilen waren doppelt oder einfach zuviel drin.

Naja durch probieren gings jetzt endlich. Danke dir trotzdem für denn Hack.
Svenkan
Wenn du nach dem kompletten Abschnitt suchen würdest, den ich da angegeben hab, hätetste auch keine Probleme. Augenzwinkern
Mystic
AUf der Startseite wirds bei mir irgendwie nicht angezeigt...
Hab aber alles so gemacht,wie es da Stand.
Svenkan
Zitat:
2. Schritt:
------------

Öffne die index.tpl und suche:

<a href="search.php?action=24h&sid=$session[hash]">aktive Themen der letzten 24h</a>

Füge darunter ein:

| <a href="search.php?action=polls&sid=$session[hash]">aktive Umfragen</a>
Mystic
Sodalle...funscht nu.
Hab index.tpl im Hauptordner umgeschrieben...nicht das in templates. :dead
Svenkan
Im root is doch gar keine index.tpl :lol
divine
Scheint ein geile hack zu sein! Kann man nun genau nach der anleitung vorgehen und es läuft?
|=RoN=|
Zitat:
Original von divine
Scheint ein geile hack zu sein! Kann man nun genau nach der anleitung vorgehen und es läuft?

Ja kann man. :lol
divine
Hat jemand ein demo? Ich weiss nicht, ob es "buttontechnisch" passt. Oder ist es ein textlink? Ein screenshot wäre geil!
Simps-O-Rama
Siehe hier im Forum bei Aktive Themen der letzten 24h auf der Startseite. Dort wird das dann auch eingefügt!
SuperVici
Bei mir wird nicht angezeigt:

Meine search.php:

php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
<?php
$filename="search.php";

require("./global.php");


if(!isset($_GET['action'])) $_GET['action']="";
#neue posts by progressive
  if($_GET['action']=="new") {
   $boardids="";
   list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards"); 
   $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
   LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
   WHERE b.password='' AND p.boardpermission=1");
   if($db->num_rows($result)<$boardcount) {
    while($row=$db->fetch_array($result)) {
     if($boardids!=""$boardids.=','.$row['boardid'];
     else $boardids=$row['boardid'];
    }
    if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
   } 
   $savepostids="";
   $result=$db->unbuffered_query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1 AND p.posttime>'$wbbuserdata[lastvisit]'
   ".ifelse($boardids,"AND t.boardid IN ($boardids)"));
   while($row=$db->fetch_array($result)) $savepostids.=','.$row['postid'];  
   if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
   $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='1' AND sortby='lastpost' AND sortorder='desc' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
   if($result['searchid']) {
    header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");    
    exit();
   }
   $db->query("INSERT INTO bb".$n."_searchs (searchid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
   VALUES (NULL,'$savepostids','0','lastpost','desc','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
   $searchid=$db->insert_id();  
   header("Location: search.php?searchid=$searchid&sid=$session[hash]");
   exit();     
  }#ende neue posts
#### Anfang alle Ankündigungen + alle wichtigen Themen ####
if($_GET['action']=="important") {
    $thread_q $db->query("SELECT * FROM bb".$n."_threads WHERE important LIKE 1");
    $name "Alle wichtigen Themen";
    $i 0;
    while($thread $db->fetch_array($thread_q)) {
        $threadid $thread['threadid'];
        $topic $thread['topic'];
        $starter $thread['starter'];
        $starttime formatdate($dateformat,$thread['starttime']);
        $lastposter $thread['lastposter'];
        $lastposttime formatdate($dateformat,$thread['lastposttime']);
        $replycount $thread['replycount'];
        $views $thread['views'];
        $i++;
        $threadlink "<a href=\"thread.php?threadid=".$threadid."&sid=$session[hash]\">".$topic."</a>";
        eval ("\$search_important_bit .= \"".$tpl->get("search_important_bit")."\";");
    }        
    eval("\$tpl->output(\"".$tpl->get("search_important")."\");");
    exit;
}
if($_GET['action']=="ank") {
    $thread_q $db->query("SELECT * FROM bb".$n."_threads WHERE important LIKE 2");
    $name "Alle Ankündigungen";
    $i 0;
    while($thread $db->fetch_array($thread_q)) {
        $threadid $thread['threadid'];
        $topic $thread['topic'];
        $starter $thread['starter'];
        $starttime formatdate($dateformat,$thread['starttime']);
        $lastposter $thread['lastposter'];
        $lastposttime formatdate($dateformat,$thread['lastposttime']);
        $replycount $thread['replycount'];
        $views $thread['views'];
        $i++;
        $threadlink "<a href=\"thread.php?threadid=".$threadid."&sid=$session[hash]\">".$topic."</a>";
        eval ("\$search_important_bit .= \"".$tpl->get("search_important_bit")."\";");
    }        
    eval("\$tpl->output(\"".$tpl->get("search_important")."\");");
    exit;
}
#### Ende alle Ankündigungen + alle wichtigen Themen ####
if($_GET['action']=="24h") {
 $boardids="";
 list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards");
 $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
 LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
 WHERE b.password='' AND p.boardpermission=1");

 if($db->num_rows($result)<$boardcount) {
  while($row=$db->fetch_array($result)) {
   if($boardids!=""$boardids.=','.$row[boardid];
   else $boardids=$row[boardid];
  }
  if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 }

 $savepostids="";
 $datecute=time()-86400;
 $result=$db->query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1 AND p.posttime>'$datecute'
 ".ifelse($boardids,"AND t.boardid IN ($boardids)"));
 while($row=$db->fetch_array($result)) $savepostids.=','.$row[postid];

 if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='0' AND sortby='lastpost' AND sortorder='desc' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
 if($result['searchid']) {
  header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");
  exit();
 }

if($_GET['action']=="polls") {
 $boardids="";
 list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards");
 if($useuseraccess==&& $wbbuserdata['userid']) {
  $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
  LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
  LEFT JOIN bb".$n."_access a ON (a.userid='$wbbuserdata[userid]' AND b.boardid=a.boardid)
  WHERE b.password='' AND ((p.boardpermission=1 AND a.userid IS NULL) OR (a.userid IS NOT NULL AND a.boardpermission=1))");
 }
 else {
  $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
  LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
  WHERE b.password='' AND p.boardpermission=1");
  }
 if($db->num_rows($result)<$boardcount) {
  while($row=$db->fetch_array($result)) {
   if($boardids!=""$boardids.=','.$row[boardid];
   else $boardids=$row[boardid];
  }
  if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 }
    
 $savepostids="";
 $datecute=time()-86400;
 $result=$db->query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1 AND t.pollid<>0
 ".ifelse($boardids,"AND t.boardid IN ($boardids)"));
 while($row=$db->fetch_array($result)) $savepostids.=','.$row[postid];
  
 if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='0' AND sortby='lastpost' AND sortorder='desc' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
 if($result['searchid']) {
  header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");
  exit();
 }
 $db->query("INSERT INTO bb".$n."_searchs (searchid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
 VALUES (NULL,'$savepostids','0','lastpost','desc','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
 $searchid=$db->insert_id();

 header("Location: search.php?searchid=$searchid&sid=$session[hash]");
 exit();
}

 $db->query("INSERT INTO bb".$n."_searchs (searchid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
 VALUES (NULL,'$savepostids','0','lastpost','desc','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
 $searchid=$db->insert_id();

 header("Location: search.php?searchid=$searchid&sid=$session[hash]");
 exit();
if($_GET['action']=="polls") {
 $boardids="";
 list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards");
 if($useuseraccess==&& $wbbuserdata['userid']) {
  $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
  LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
  LEFT JOIN bb".$n."_access a ON (a.userid='$wbbuserdata[userid]' AND b.boardid=a.boardid)
  WHERE b.password='' AND ((p.boardpermission=1 AND a.userid IS NULL) OR (a.userid IS NOT NULL AND a.boardpermission=1))");
 }
 else {
  $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
  LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
  WHERE b.password='' AND p.boardpermission=1");
  }
 if($db->num_rows($result)<$boardcount) {
  while($row=$db->fetch_array($result)) {
   if($boardids!=""$boardids.=','.$row[boardid];
   else $boardids=$row[boardid];
  }
  if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 }
    
 $savepostids="";
 $datecute=time()-86400;
 $result=$db->query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1 AND t.pollid<>0
 ".ifelse($boardids,"AND t.boardid IN ($boardids)"));
 while($row=$db->fetch_array($result)) $savepostids.=','.$row[postid];
  
 if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='0' AND sortby='lastpost' AND sortorder='desc' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
 if($result['searchid']) {
  header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");
  exit();
 }
 $db->query("INSERT INTO bb".$n."_searchs (searchid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
 VALUES (NULL,'$savepostids','0','lastpost','desc','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
 $searchid=$db->insert_id();

 header("Location: search.php?searchid=$searchid&sid=$session[hash]");
 exit();
}
}
if($_GET['action']=="user") {
 if(!isset($_GET['userid'])) eval("error(\"".$tpl->get("error_falselink")."\");");

 $boardids="";
 list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards");
 $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
 LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
 WHERE b.password='' AND p.boardpermission=1");

 if($db->num_rows($result)<$boardcount) {
  while($row=$db->fetch_array($result)) {
   if($boardids!=""$boardids.=','.$row[boardid];
   else $boardids=$row[boardid];
  }
  if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 }

 $savepostids="";
 $userid=intval($_GET['userid']);
 $result=$db->query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1 AND p.userid='$userid'
 ".ifelse($boardids,"AND t.boardid IN ($boardids)"));
 while($row=$db->fetch_array($result)) $savepostids.=','.$row[postid];

 if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='1' AND sortby='lastpost' AND sortorder='desc' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
 if($result['searchid']) {
  header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");
  exit();
 }
 $db->query("INSERT INTO bb".$n."_searchs (searchid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
 VALUES (NULL,'$savepostids','1','lastpost','desc','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
 $searchid=$db->insert_id();

 header("Location: search.php?searchid=$searchid&sid=$session[hash]");
 exit();
}

if($_GET['action']=="noreplie") {
 $boardids="";
 list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards");
 $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
 LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
 WHERE b.password='' AND p.boardpermission=1");

 if($db->num_rows($result)<$boardcount) {
  while($row=$db->fetch_array($result)) {
   if($boardids!=""$boardids.=','.$row[boardid];
   else $boardids=$row[boardid];
  }
  if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 }

 $savepostids="";
 $result=$db->query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1 AND t.replycount=0
 ".ifelse($boardids,"AND t.boardid IN ($boardids)"));
 while($row=$db->fetch_array($result)) $savepostids.=','.$row[postid];

 if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
 $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='0' AND sortby='lastpost' AND sortorder='desc' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
 if($result['searchid']) {
  header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");
  exit();
 }
 $db->query("INSERT INTO bb".$n."_searchs (searchid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
 VALUES (NULL,'$savepostids','0','lastpost','desc','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
 $searchid=$db->insert_id();

 header("Location: search.php?searchid=$searchid&sid=$session[hash]");
 exit();
}

if(isset($_GET['searchid'])) {
 require("./acp/lib/class_parse.php");

 $searchid=intval($_GET['searchid']);
 if($wbbuserdata['userid']) $search=$db->query_first("SELECT * FROM bb".$n."_searchs WHERE searchid='$searchid' AND userid='$wbbuserdata[userid]'");
 else $search=$db->query_first("SELECT * FROM bb".$n."_searchs WHERE searchid='$searchid' AND ipaddress='$REMOTE_ADDR'");

 if(!$search['searchid']) access_error();

 if(isset($_COOKIE['threadvisit'])) $threadvisit=decode_cookie($_COOKIE['threadvisit']);
 else $threadvisit=array();

 if(isset($_COOKIE['boardvisit'])) $boardvisit=decode_cookie($_COOKIE['boardvisit']);
 else $boardvisit=array();

 if($search['showposts']==1) {
  if(isset($_COOKIE['postvisit'])) $postvisit=decode_cookie($_COOKIE['postvisit']);
  else $postvisit=array();

  switch($search['sortby']) {
   case "topic"$sortby="p.posttopic"; break;
   case "replycount"$sortby="t.replycount"; break;
   case "lastpost"$sortby="p.posttime"; break;
   case "author"$sortby="p.username"; break;
   case "board"$sortby="b.title";
   case "views"$sortby="t.views";
   default: $sortby="p.posttime"; break;
  }

  switch($search['sortorder']) {
   case "asc"$sortorder="asc"; break;
   case "desc"$sortorder="desc"; break;
   default: $sortorder="desc"; break;
  }

  list($postcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_posts WHERE postid IN (0$search[postids])");

  if($wbbuserdata['umaxposts']) $postsperpage=$wbbuserdata['umaxposts'];
  else $postsperpage=$default_postsperpage;
  if(isset($_GET['page'])) {
   $page=intval($_GET['page']);
   if($page==0$page=1;
  }
  else $page=1;
  $pages ceil($postcount/$postsperpage);
  if($pages>1$pagelink=makepagelink("search.php?searchid=$searchid&sid=$session[hash]",$page,$pages,$showpagelinks-1);

  $l_posts = ($page-1)*$postsperpage+1;
  $h_posts $page*$postsperpage;
  if($h_posts $postcount$h_posts $postcount;

  $threadjoin="";
  $boardjoin="";
  if(strstr($sortby,'t.') || strstr($sortby,'b.')) $threadjoin="LEFT JOIN bb".$n."_threads t USING (threadid)";
  if(strstr($sortby,'b.')) $boardjoin="LEFT JOIN bb".$n."_boards b USING (boardid)";

  $postids="";
  $result $db->query("SELECT p.postid FROM bb".$n."_posts p
   $threadjoin
   $boardjoin
   WHERE p.postid IN (0$search[postids])
   ORDER BY $sortby $sortorder LIMIT ".($postsperpage*($page-1)).",".$postsperpage);

  while($row=$db->fetch_array($result)) $postids .= ",".$row[postid];

  $parse = new parse($docensor,75,0,0,$wbbuserdata['showimages'],$usecode);
  $result $db->query("SELECT
   p.*,
   t.topic, t.replycount, t.views, t.boardid, t.lastposttime, t.closed,t.prefix,
   b.title, b.allowsmilies AS b_allowsmilies, b.allowhtml, b.allowbbcode, b.allowimages, b.allowicons,
   b.hotthread_reply, b.hotthread_view,
   i.iconpath, i.icontitle
   FROM bb".$n."_posts p
   LEFT JOIN bb".$n."_threads t USING (threadid)
   LEFT JOIN bb".$n."_boards b USING (boardid)
   LEFT JOIN bb".$n."_icons i ON (p.iconid=i.iconid)
   WHERE p.postid IN (0$postids)
   ORDER BY $sortby $sortorder");

  $count=0;

  while($posts=$db->fetch_array($result)) {
   $tdbgcolor=getone($count,"{tablecolora}","{tablecolorb}");
   $tdid=getone($count,"tablea","tableb");

   if($posts['hotthread_reply']==0$posts['hotthread_reply']=$default_hotthread_reply;
   if($posts['hotthread_view']==0$posts['hotthread_view']=$default_hotthread_view;

   $foldericon=ifelse($wbbuserdata['lastvisit']<$posts['lastposttime'] && $threadvisit[$posts['threadid']]<$posts['lastposttime'] && $boardvisit[$posts['boardid']]<$posts['lastposttime'],"new").ifelse($posts['replycount']>=$posts['hotthread_reply'] || $posts['views']>=$posts['hotthread_view'],"hot").ifelse($posts['closed']!=0,"lock")."folder";

   $posts['message']=$parse->doparse($posts['message'],$posts['allowsmilies']*$posts['b_allowsmilies'],$posts['allowhtml'],$posts['allowbbcode'],$posts['allowimages']);
   $posts['posttopic']=$parse->textwrap($posts['posttopic'],60);
   $posts['topic']=$parse->textwrap($posts['topic'],60);

   if($posts[iconid] && $posts[allowicons]==1$posticon="<img src=\"$posts[iconpath]\" alt=\"$posts[icontitle]\">";
   else $posticon="";
   if($wbbuserdata['lastvisit']<$posts['posttime'] && $postvisit[$posts['postid']]!=&& $boardvisit[$posts['boardid']]<$posts['lastposttime']) eval ("\$postsign = \"".$tpl->get("thread_newpost")."\";");
   else eval ("\$postsign = \"".$tpl->get("thread_nonewpost")."\";");
   $postdate=formatdate($dateformat,$posts['posttime'],1);
   $posttime=formatdate($timeformat,$posts['posttime']);

   if($posts['userid']) eval ("\$posts[username] = \"".$tpl->get("thread_username")."\";");

if($posts['prefix']!="") {
    $threads['prefix']=$posts['prefix'];    
    eval ("\$prefix = \"".$tpl->get("board_thread_prefix")."\";");
   }
   eval ("\$postbit .= \"".$tpl->get("search_postbit")."\";");
   $count++;
  }
  eval("\$tpl->output(\"".$tpl->get("search_post")."\");");
 }
 else {
  switch($search['sortby']) {
   case "topic"$sortby="t.topic"; break;
   case "replycount"$sortby="t.replycount"; break;
   case "lastpost"$sortby="t.lastposttime"; break;
   case "author"$sortby="t.starter"; break;
   case "board"$sortby="b.title";
   case "views"$sortby="t.views";
   default: $sortby="t.lastposttime"; break;
  }

  switch($search['sortorder']) {
   case "asc"$sortorder="asc"; break;
   case "desc"$sortorder="desc"; break;
   default: $sortorder="desc"; break;
  }


  $threadids="";
  $result=$db->query("SELECT DISTINCT threadid FROM bb".$n."_posts WHERE postid IN (0$search[postids])");
  $threadcount=$db->num_rows($result);
  while($row=$db->fetch_array($result)) $threadids.=','.$row['threadid'];

  //$postsperpage=$default_postsperpage;
  $threadsperpage=$default_threadsperpage;
  if(isset($_GET['page'])) {
   $page=intval($_GET['page']);
   if($page==0$page=1;
  }
  else $page=1;
  $pages ceil($threadcount/$threadsperpage);
  if($pages>1$pagelink=makepagelink("search.php?searchid=$searchid&sid=$session[hash]",$page,$pages,$showpagelinks-1);

  $result=$db->query("SELECT t.threadid FROM bb".$n."_threads t
  ".ifelse($sortby=="f.title","LEFT JOIN bb".$b."_boards b USING (boardid)")."
  WHERE t.threadid IN (0$threadids)
  ORDER BY $sortby $sortorder LIMIT ".($threadsperpage*($page-1)).",".$threadsperpage);
  $threadids="";
  while($row=$db->fetch_array($result)) $threadids.=','.$row['threadid'];

  $ownuserid "";
  $ownjoin "";

  $result $db->query("SELECT
   $ownuserid
   t.*,
   b.title, b.hotthread_reply, b.hotthread_view, b.postsperpage,
   i.*
   FROM bb".$n."_threads t
   LEFT JOIN bb".$n."_icons i USING (iconid)
   LEFT JOIN bb".$n."_boards b ON (b.boardid=t.boardid)
   $ownjoin
   WHERE t.threadid IN (0$threadids)
   ORDER BY $sortby $sortorder");

  while($threads=$db->fetch_array($result)) {
   unset($firstnew);
   unset($multipages);
   $prefix="";

   if(strlen($threads['topic'])>60$threads['topic']=parse::textwrap($threads['topic'],60);
   if($threads['voted']) {
    $avarage=number_format($threads['votepoints']/$threads['voted'],2);
    eval ("\$threadrating = \"".$tpl->get("board_threadbit_rating")."\";");
    $threadrating=str_repeat($threadratinground($avarage));
   }
   else $threadrating="&nbsp;";

   if($threads['pollid']!=0) eval ("\$prefix .= \"".$tpl->get("board_thread_poll")."\";");
   if($threads['prefix']!="") eval ("\$prefix .= \"".$tpl->get("board_thread_prefix")."\";");

   if($threads['hotthread_reply']==0$threads['hotthread_reply']=$default_hotthread_reply;
   if($threads['hotthread_view']==0$threads['hotthread_view']=$default_hotthread_view;

   if($threads['pollid']!=0$foldericon="poll";
   else $foldericon=ifelse($threads[userid],"dot").ifelse($wbbuserdata['lastvisit']<$threads['lastposttime'] && $threadvisit[$threads['threadid']]<$threads['lastposttime'] && $boardvisit[$threads['boardid']]<$threads['lastposttime'],"new").ifelse($threads[replycount]>=$threads[hotthread_reply] || $threads[views]>=$threads[hotthread_view],"hot").ifelse($threads[closed]!=0,"lock")."folder";
   if($wbbuserdata[lastvisit]<$threads[lastposttime] && $threadvisit[$threads[threadid]]<$threads[lastposttime]) eval ("\$firstnew = \"".$tpl->get("board_threadbit_firstnew")."\";");
   if($threads[iconid]) $threadicon="<img src=\"$threads[iconpath]\" alt=\"$threads[icontitle]\">";
   else $threadicon="&nbsp;";
   if($threads[starterid]!=0) eval ("\$threads[starter] = \"".$tpl->get("board_threadbit_starter")."\";");
   if($threads[lastposterid]!=0) eval ("\$threads[lastposter] = \"".$tpl->get("board_threadbit_lastposter")."\";");

   $lastpostdate=formatdate($dateformat,$threads[lastposttime],1);
   $lastposttime=formatdate($timeformat,$threads[lastposttime]);

   if($wbbuserdata['umaxposts']) $postsperpage=$wbbuserdata['umaxposts'];
   elseif($threads['postsperpage']) $postsperpage=$threads['postsperpage'];
   else $postsperpage=$default_postsperpage;

   if($threads['replycount']+1>$postsperpage && $showmultipages!=0) {
    unset($multipage);
    unset($multipages_lastpage);
    $xpages=ceil(($threads[replycount]+1)/$postsperpage);
    if($xpages>$showmultipages) {
     eval ("\$multipages_lastpage = \"".$tpl->get("board_threadbit_multipages_lastpage")."\";");
     $xpages=$showmultipages;
    }
    for($i=1;$i<=$xpages;$i++) {
     $multipage.=" ".makehreftag("thread.php?threadid=$threads[threadid]&page=$i&sid=$session[hash]",$i);
    }
    eval ("\$multipages = \"".$tpl->get("board_threadbit_multipages")."\";");
   }
   eval ("\$threadbit .= \"".$tpl->get("search_threadbit")."\";");
  }

  $l_threads = ($page-1)*$threadsperpage+1;
  $h_threads $page*$threadsperpage;
  if($h_threads $threadcount$h_threads $threadcount;

  eval("\$tpl->output(\"".$tpl->get("search_thread")."\");");
 }
}
else {
 if(isset($_POST['send'])) {
  $searchstring=trim($_POST['searchstring']);
  $searchuser=trim($_POST['searchuser']);

  if(!$searchstring && !$searchuser) eval("error(\"".$tpl->get("error_invalidsearch")."\");");

  $postids="";
  if($searchstring) {
   $topiconly=$_POST[topiconly];

   $searchstring=preg_replace("/[\/:;'\"\(\)\[\]?!#{}%\-+\\\\]/s","",$searchstring);
   $searchstring=preg_replace("/\s{2,}/"," ",$searchstring);
   $tempsearchstring=$searchstring;
   $searchstring=str_replace("*","%",$searchstring);
   $searchstring=preg_replace("/(%){2,}/s""%"$searchstring);
   $searchwords=preg_split("/[\s]/"strtolower($searchstring), -1PREG_SPLIT_NO_EMPTY);

   $badwords=array();
   if($badsearchwords) {
    $temp=explode("\n",$badsearchwords);
    while(list($key,$val)=each($temp)) $badwords[trim($val)]=1;
   }

   $count_total=0;
   $count_bad=0;
   $firstloop=1;
   $addsplit="";
   $wordids="";
   $tempwordids=array();
   $wordidcache=array();
   $andlist=array();
   $orlist=array();
   $notlist=array();
   $tempwordids=array();
   $foundwordids=array();
   $wordcache=array();
   $doublecount=0;
   $i=array("AND" => 0,"OR" => 0,"NOT" => 0);
   while(list($key,$val)=each($searchwords)) {
    if($val=="and" || $val=="or" || $val=="not") {
     $addsplit=strtoupper($val);
     continue;
    }

    $count_total++;
    if($badwords[$val]==|| strlen($val)<$minwordlength || strlen($val)>$maxwordlength) {
     $count_bad++;
     continue;
    }

    $result=$db->query("SELECT wordid FROM bb".$n."_wordlist WHERE word LIKE '$val'");
    if($db->num_rows($result)) {
     while($row=$db->fetch_array($result)) {
      if($firstloop==1$tempwordids[]=$row['wordid'];
      else {
       if($addsplit==""$addsplit="AND";
       $wordidcache[$addsplit][$i[$addsplit]][]=$row['wordid'];
       if(count($tempwordids)) {
        reset($tempwordids);
        $doublecount=1;
        while(list($key2,$wordid)=each($tempwordids)) {
         if($addsplit=="NOT"$wordidcache['AND'][$i[$addsplit]+1][]=$wordid;
         else $wordidcache[$addsplit][$i[$addsplit]+1][]=$wordid;
        }
        $tempwordids=array();
       }
      }
      $wordids.=",".$row['wordid'];
     }
     $firstloop=0;
    }
    elseif($firstloop==&& $addsplit=="AND") {
     unset($wordids);
     break;
    }


    if($doublecount==1) {
     $i[$addsplit]++;
     $doublecount=0;
    }
    $i[$addsplit]++;
   }

   if($count_bad>&& $count_bad==$count_total) eval("error(\"".$tpl->get("error_searchbad")."\");");

   if(count($tempwordids)) {
    reset($tempwordids);
    while(list($key2,$wordid)=each($tempwordids)) $wordidcache['AND'][$i[$addsplit]][]=$wordid;
   }

   $foundpostids=array();
   if($wordids) {
    $result=$db->query("SELECT wordid, postid FROM bb".$n."_wordmatch WHERE wordid IN (0$wordids)".ifelse($topiconly==1," AND intopic=1"));
    while($row=$db->fetch_array($result)) {
     $foundpostids[$row['wordid']][$row['postid']]=1;
    }
   }

   function myArrayMerge($array,$add) {
    while(list($key,$val)=each($add)) $array[$key]=$val;
    return $array;
   }

   function mySearchArray($array,$add,$mode) {
    if($mode=="OR") return myArrayMerge($array,$add);
    if($mode=="AND") {
     $newarray=array();
     while(list($key,$val)=each($array)) if($add[$key]==1$newarray[$key]=1;
     return $newarray;
    }
    if($mode=="NOT") {
     while(list($key,$val)=each($add)) if($array[$key]==1$array[$key]=0;
     return $array;
    }
   }

   $globalarray=array();
   $addsplit=array("AND","OR","NOT");
   for($i=0;$i<3;$i++) {
    $savearray=array();
    $count=0;
    if(count($wordidcache[$addsplit[$i]])) {
     reset($wordidcache[$addsplit[$i]]);
     while(list($key,$wordids)=each($wordidcache[$addsplit[$i]])) {
      $savearray[$count]=array();
      $badx 1;
      while(list($key2,$wordid)=each($wordids)) {
       if(isset($foundpostids[$wordid])) {
        $badx=0;
        $savearray[$count]=myArrayMerge($savearray[$count],$foundpostids[$wordid]);
       }
      }

      if($badx==0) {
       if(!count($globalarray)) $globalarray=$savearray[$count];
       else $globalarray mySearchArray($globalarray,$savearray[$count],$addsplit[$i]);
      }

      $count++;
     }
    }
   }

   $postids="";
   while(list($key,$val)=each($globalarray)) {
    if($val!=1) continue;
    if($postids==""$postids=$key;
    else $postids.=",$key";
   }
  }

  if($searchuser) {
   $userids="";
   if($_POST['name_exactly']==1$result=$db->query("SELECT userid FROM bb".$n."_users WHERE username='".addslashes(htmlspecialchars($searchuser))."'");
   else $result=$db->query("SELECT userid FROM bb".$n."_users WHERE username LIKE '%".addslashes(htmlspecialchars($searchuser))."%'");
   while($row=$db->fetch_array($result)) {
    if($userids!=""$userids.=','.$row[userid];
    else $userids=$row[userid];
   }
  }

  if(!$userids && !$postids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");

  if($_POST['searchdate']) {
   $cutetime=time()-86400*intval($_POST['searchdate']);
   if($_POST['beforeafter']=="after"$searchdate="posttime>='$cutetime'";
   else $searchdate="posttime<'$cutetime'";
  }

  if(isset($_POST['boardids']) && is_array($_POST['boardids']) && count($_POST['boardids'])) {
   reset($_POST['boardids']);
   if(count($_POST['boardids']) && $_POST['boardids'][0]!='*') {
    $tempids="";
    while(list($key,$val)=each($_POST['boardids'])) if($val>0$tempids.=",".$val;
    if($tempids) {
     $result=$db->query("SELECT boardid, childlist FROM bb".$n."_boards WHERE boardid IN (0$tempids)");
     $selectedids="";
     while($row=$db->fetch_array($result)) {
      $selectedids.=",".$row[boardid];
      if($row[childlist]) $selectedids.=",".$row[childlist];
     }
    }
   }
  }

  $boardids="";
  list($boardcount)=$db->query_first("SELECT COUNT(*) FROM bb".$n."_boards");
  $result=$db->query("SELECT b.boardid FROM bb".$n."_boards b
  LEFT JOIN bb".$n."_permissions p ON (p.groupid='$wbbuserdata[groupid]' AND b.boardid=p.boardid)
  WHERE ".ifelse($_POST['boardids'][0]!='*',"b.boardid IN (0$selectedids) AND ")."b.password='' AND p.boardpermission=1");

  if($db->num_rows($result)<$boardcount) {
   while($row=$db->fetch_array($result)) {
    if($boardids!=""$boardids.=','.$row[boardid];
    else $boardids=$row[boardid];
   }
   if(!$boardids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
  }

  $savepostids="";
  $result=$db->query("SELECT p.postid FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.visible=1
  ".ifelse($postids,"AND p.postid IN ($postids)")."
  ".ifelse($userids,"AND p.userid IN ($userids)")."
  ".ifelse($boardids,"AND t.boardid IN ($boardids)")."
  ".ifelse($searchdate,"AND $searchdate"));
  while($row=$db->fetch_array($result)) $savepostids.=','.$row[postid];

  if(!$savepostids) eval("error(\"".$tpl->get("error_searchnoresult")."\");");
  $result=$db->query_first("SELECT searchid FROM bb".$n."_searchs WHERE postids='$savepostids' AND showposts='$_POST[showposts]' AND sortby='$_POST[sortby]' AND sortorder='$_POST[sortorder]' AND userid='$wbbuserdata[userid]' AND ipaddress='$REMOTE_ADDR'");
  if($result['searchid']) {
   header("Location: search.php?searchid=$result[searchid]&sid=$session[hash]");
   exit();
  }

  $db->query("INSERT INTO bb".$n."_searchs (searchid,searchstring,searchuserid,postids,showposts,sortby,sortorder,searchtime,userid,ipaddress)
  VALUES (NULL,'".addslashes($tempsearchstring)."','".ifelse(!strstr($userids,','),$userids,0)."','$savepostids','".intval($_POST['showposts'])."','".addslashes($_POST['sortby'])."','".addslashes($_POST['sortorder'])."','".time()."','$wbbuserdata[userid]','$REMOTE_ADDR')");
  $searchid=$db->insert_id();

  header("Location: search.php?searchid=$searchid&sid=$session[hash]");
  exit();
 }
 else {
  $result $db->query("SELECT boardid, parentid, boardorder, title, invisible FROM bb".$n."_boards ORDER by parentid ASC, boardorder ASC");
  while ($row $db->fetch_array($result)) $boardcache[$row[parentid]][$row[boardorder]][$row[boardid]] = $row;

  $result $db->query("SELECT * FROM bb".$n."_permissions WHERE groupid = '$wbbuserdata[groupid]'");
  while ($row $db->fetch_array($result)) $permissioncache[$row[boardid]] = $row;

  $board_options=makeboardselect(0);

  eval("\$tpl->output(\"".$tpl->get("search")."\");");
 }
}
?>
Pengoo
Bei mir zeigt der Hack leider nicht nur die aktiven Umfragen an, sondern, wie ich nun feststellen musste, ausnahmslos alle - also auch bereits abgelaufene Umfragen. Geht nur mir das so? *kopfkratz*