alle Ankündigungen + alle wichtigen Themen

Helmchen
Titel: alle Ankündigungen + alle wichtigen Themen
Version: 1.0
Beschreibung: Hack Ersteller: Helmchen (bei AFF Lord Helmchen ...)
Forenversion: WBB lite 1.x.x

Beschreibung:
Dieser Hack fügt zu dem link "alle Themen der letzten 24h" noch die 2 Links "alle Ankündigungen" und "alle wichtigen Themen" hinzu und listet diese bei Bedarf auf.


Copyright ist denke ich klar...
-> ansonsten siehe Readme^^


Have a nice day everyone ^_^
----


weiter zum Download
SnakeBlood
Finde den Hack gut , eingebaut , ohne Probs smile

Aber eins Habe ich noch , in der Team Ecke habe ich Themen die die normalen User natürlich nichts angehen , diese sieht aber mein Testuser, er kommt zwar nicht drauf aber er sieht den Namen des Themas , kann man das noch abstellen ?
MrMind
Zitat:
Original von SnakeBlood
Finde den Hack gut , eingebaut , ohne Probs smile

Aber eins Habe ich noch , in der Team Ecke habe ich Themen die die normalen User natürlich nichts angehen , diese sieht aber mein Testuser, er kommt zwar nicht drauf aber er sieht den Namen des Themas , kann man das noch abstellen ?


Na klar, da müsste man nur die SQL-Abfrage soweit erweitern, das die Permissions mit einbezogen werden.

Mfg
MrMind
SnakeBlood
Aber wie ? Kenn mich da nicht so genau aus , will da nix schrotten smile
MrMind
Zitat:
Original von SnakeBlood
Aber wie ? Kenn mich da nicht so genau aus , will da nix schrotten smile


Dann poste doch mal bitte den SQL-Code, dann kann ich mal den anpassen.

Mfg
MrMind
SnakeBlood
Öhm ...
aus welcher Tabelle ? Bzw welchen SQL Code?
MrMind
Du fügst ja in eine PHP-Datei (wahrscheinlich in der index.php) einen weiteren Code hinzu wo ein SQL-Code enthalten ist ($result = $db->query(SQL-CODE)) diesen will ich sehen.

Mfg
MrMind
SnakeBlood
Das ist mehrmals da , ich hänge dir die mal index.php an !
MrMind
Poste lieber mal die Veränderungen laut Anleitungen, weil du hast bestimmt viele Hacks drinnen und da finde ich net sofort die Zeilen für diesen Hack.

Mfg
MrMind
SnakeBlood
Joa habe gut was an Hacks drinne inwzischen ...
Wenn du die meinst aus diesem Hack hier :


zu ändernde Dateien: - search.php
- templates/index.tpl

neue Dateien: - templates/search_important.tpl
- templates/search_important_bit.tpl


---------------------------------------------------------------------------
--------------------
----------Vergesst nicht ein Backup (der zu ändernden Dateien) zu machen !!!! -----------------
---------------------------------------------------------------------------
--------------------
-----------> los geht es smile <------------------------------------------------------------------
---------------------------------------------------------------------------
--------------------
--> search.php


suche nach:

if($_GET['action']=="24h") {

darüber einfügen:

#### 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 ####


---------------------------------------------------------------------------
--------------------
--> templates/index.tpl

suche nach:

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

ersetzen durch:

<a href="search.php?action=important&sid=$session[hash]">Alle wichtigen Themen</a> |
<a href="search.php?action=ank&sid=$session[hash]">Alle Ankündigungen</a> |
<a href="search.php?action=24h&sid=$session[hash]">aktive Themen der letzten 24h</a>
MrMind
Diese Zeile:

php:
1:
$thread_q $db->query("SELECT t.*, b.boardid FROM bb".$n."_threads t, bb".$n."_boards b LEFT JOIN bb".$n."_permissions p ON(p.boardid = b.boardid AND ".$wbbuserdata['groupid']." = p.groupid AND boardpermission=1) WHERE important LIKE 1");


in diese Zeile hier:

php:
1:
$thread_q $db->query("SELECT * FROM bb".$n."_threads WHERE important LIKE 1");


ändern

sowie diese Zeile:

php:
1:
$thread_q $db->query("SELECT * FROM bb".$n."_threads WHERE important LIKE 2");


in diese Zeile hier:

php:
1:
$thread_q $db->query("SELECT t.*, b.boardid FROM bb".$n."_threads t, bb".$n."_boards b LEFT JOIN bb".$n."_permissions p ON(p.boardid = b.boardid AND ".$wbbuserdata['groupid']." = p.groupid AND boardpermission=1) WHERE important LIKE 2");


Das sollte Funktionieren.

Mfg
MrMind
Beckebans
Hi, ich hab das hier immer mal mitgelesen und hab die Änderung von MrMind gerade eingebaut. Wenn ich jetzt aber auf "Alle wichtigen Themen" klicke werden die wichtigen Themen 124 mal aufgelistet. Die Themen, die nicht zu sehen sein sollten erscheinen trotzdem.

Bsp:
Vorher wurden 4 Themen angezeigt. 3 normale und eine, die weg sollte. Diese 4 Themen werden jetzt also immer wieder untereinander angezeigt.
Oben links steht: Insgesammt 496 Themen gefunden


PS: Die ersten beiden Code-Zeilen sind vertauscht.
SnakeBlood
Ich denke mal in der Seach.php , da habe ich geguckt aber die erste Zeile die ich ändern soll also die :
code:
1:
$thread_q = $db->query("SELECT t.*, b.boardid FROM bb".$n."_threads t, bb".$n."_boards b LEFT JOIN bb".$n."_permissions p ON(p.boardid = b.boardid AND ".$wbbuserdata['groupid']." = p.groupid AND boardpermission=1) WHERE important LIKE 1"); 


Finde ich schon nicht unglücklich

Kannst du da vielleicht mal drauf gucken ?

Hier mal die Index.php :
code:
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:
<?php
$filename="index.php";

require("./global.php");

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

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

$boardcache=array();
$permissioncache=array();
$modcache=array();

$activtime=time()-60*$useronlinetimeout;

$result = $db->query("
 SELECT
 b.*".ifelse($showlastposttitle==1,", t.topic, i.*")."
 FROM bb".$n."_boards b
 ".ifelse($showlastposttitle==1,"LEFT JOIN bb".$n."_threads t ON (t.threadid=b.lastthreadid)
 LEFT JOIN bb".$n."_icons i USING (iconid)")."
 ORDER by b.parentid ASC, b.boardorder ASC");
while ($row = $db->fetch_array($result)) $boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;


if($ankuendigungonoff==1) eval ("\$ankuendigungoutput = \"".$tpl->get("ankuendigung")."\";");
 $user_info = $db->query_first("SELECT
 u.*,
 a.avatarextension, a.width, a.height
 FROM bb".$n."_users u
 LEFT JOIN bb".$n."_avatars a ON (a.avatarid=u.avatarid)
 WHERE u.userid='$wbbuserdata[userid]'");
$result = $db->query("SELECT boardid, threadid, lastposttime FROM bb".$n."_threads WHERE visible = 1 AND lastposttime > '$wbbuserdata[lastvisit]' AND closed <> 3");
while($row=$db->fetch_array($result)) $visitcache[$row['boardid']][$row['threadid']]=$row['lastposttime'];

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

$result = $db->query("SELECT bb".$n."_moderators.*, username FROM bb".$n."_moderators LEFT JOIN bb".$n."_users USING (userid) ORDER BY username ASC");
while ($row = $db->fetch_array($result)) $modcache[$row['boardid']][] = $row;

$boardbit = makeboardbit(0);

$index_pms="";
$quicklogin="";
$index_useronline="";
$index_stats="";

/* ############## STATS ############## */
if($showstats==1) {
 $members=$db->query_first("SELECT COUNT(*) AS members, MAX(userid) AS userid FROM bb".$n."_users WHERE activation = 1");
 $newestmember=$db->query_first("SELECT userid, username FROM bb".$n."_users WHERE userid = '$members[userid]'");
 $posts=$db->query_first("SELECT COUNT(*) AS posts FROM bb".$n."_posts");
 $threads=$db->query_first("SELECT COUNT(*) AS threads FROM bb".$n."_threads");
 $threadviews=$db->query_first("SELECT SUM(views) AS threadviews FROM bb".$n."_threads");

 $installdays = (time() - $installdate) / 86400;
 if ($installdays < 1) $postperday = $posts['posts'];
 else $postperday = sprintf("%.2f",($posts['posts'] / $installdays));

 ####Anfang Erweiterte Statistik####
 $gespuserfrage = $db->query("SELECT blocked FROM bb".$n."_users WHERE blocked='1'");
 $gespuser2=mysql_num_rows($gespuserfrage);
 if($gespuser2==1) {
 	$gespuser="1 gesperrter";
 }
 else {
 	$gespuser="".$gespuser2." gesperte";
 }
 $nafrage = $db->query("SELECT activation FROM bb".$n."_users WHERE activation='0'");
 $na2=mysql_num_rows($nafrage);
 if($na2==1) {
	 $na="1 nicht freigeschalteter";
 }
 else {
	 $na="".$na2." nicht freigeschaltete";
 }
 $gmfrage = $db->query("SELECT gender FROM bb".$n."_users WHERE gender='1'");
 $gm=mysql_num_rows($gmfrage);
 $gkafrage = $db->query("SELECT gender FROM bb".$n."_users WHERE gender='0'");
 $gka=mysql_num_rows($gkafrage);
 $gwfrage = $db->query("SELECT gender FROM bb".$n."_users WHERE gender='2'");
 $gw=mysql_num_rows($gwfrage);
 $posts2 = $db->query_first("SELECT COUNT(postid) AS posts FROM bb".$n."_posts");
 $members2 = $db->query_first("SELECT COUNT(userid) AS members FROM bb".$n."_users ");
 $anzahlposts = ($posts2['posts']);
 $anzahluser = ($members2['members']);
 $bu=sprintf("%.3f",$anzahlposts / $anzahluser);
	
 ####Ende Erweiterte Statistik####
 eval ("\$index_stats = \"".$tpl->get("index_stats")."\";");
}
/* ############## Top 5 Statistik Mainpage Start ############## */

// Start Top 5 Poster
$posts5 = $db->query("SELECT userid,username,userposts FROM bb".$n."_users ORDER BY userposts DESC LIMIT 5");
while ($posts5top = $db->fetch_array($posts5)){
    
    $posts5name .= "» <a href=profile.php?userid=$posts5top[userid]&sid=$session[hash]>$posts5top[username]</a><br>";
    $posts5post .= "$posts5top[userposts] <br>";
}
// Ende Top 5 Poster

// Start Letzte 5 Mitglieder
$user = $db->query("SELECT userid,userposts,username,regdate FROM bb".$n."_users WHERE activation='1' ORDER BY regdate DESC LIMIT 5");
while ($usertop = $db->fetch_array($user)){
    
    $username .= "» <a href=\"profile.php?userid=$usertop[userid]&sid=$session[hash]\">$usertop[username]</a><br>";
    $userposts .= "$usertop[userposts] <br>";
}
// Ende Letzte 5 Mitglieder

// Start Letzte 5 Beiträge
$pop = $db->query("SELECT
	bb".$n."_threads.topic,
	bb".$n."_threads.threadid,
        bb".$n."_threads.lastposttime,
	bb".$n."_threads.views,
        bb".$n."_users.userid,
	bb".$n."_threads.boardid as parentid,
	bb".$n."_users.username,
	bb".$n."_boards.invisible	
	FROM bb".$n."_threads
	LEFT JOIN bb".$n."_users ON (bb".$n."_users.userid=bb".$n."_threads.lastposterid) 
	LEFT JOIN bb".$n."_boards ON (bb".$n."_boards.boardid=bb".$n."_threads.boardid)
	WHERE bb".$n."_boards.invisible=0
	ORDER BY bb".$n."_threads.lastposttime DESC LIMIT 5");
while ($poptop = $db->fetch_array($pop)){
   
    if(strlen($poptop[topic]) > '37') $poptop[topic] = "".substr($poptop[topic], 0, 34)."...";
    $popthread .= "» <a href=\"thread.php?goto=lastpost&threadid=$poptop[threadid]&sid=$session[hash]\">$poptop[topic]</a><br>";
    $lastposter .= "<a href=\"profile.php?userid=$poptop[userid]&sid=$session[hash]\">$poptop[username]</a><br>";
    $popviews .= "$poptop[views] <br>";
}    
// Ende Letzte 5 Beiträge

// Start Top Themen
$pop1 = $db->query("SELECT bb".$n."_threads.topic,
	bb".$n."_threads.threadid,
	bb".$n."_threads.views,
	bb".$n."_threads.boardid, 
	bb".$n."_boards.invisible
	FROM bb".$n."_threads
	LEFT JOIN bb".$n."_boards ON (bb".$n."_boards.boardid=bb".$n."_threads.boardid)
	WHERE bb".$n."_boards.invisible=0
	ORDER BY bb".$n."_threads.views DESC LIMIT 1");
while ($pop1top = $db->fetch_array($pop1)){
    
    $pop1title = "<a href=\"thread.php?threadid=$pop1top[threadid]&boardid=$pop1top[boardid]&sid=$session[hash]\">$pop1top[topic]</a>";
    $pop1views = "$pop1top[views]";
}
// Ende Top Themen
// Start Top Bewertung
$voted = $db->query("SELECT bb".$n."_threads.topic,
	bb".$n."_threads.threadid,
	bb".$n."_threads.voted,
	bb".$n."_threads.votepoints,
	bb".$n."_threads.boardid,
	bb".$n."_boards.invisible
	FROM bb".$n."_threads
	LEFT JOIN bb".$n."_boards ON (bb".$n."_boards.boardid=bb".$n."_threads.boardid)
	WHERE bb".$n."_boards.invisible=0 
	ORDER BY bb".$n."_threads.voted DESC LIMIT 1");
while ($votedtop = $db->fetch_array($voted)){
    
    $votedthread = "<a href=\"thread.php?threadid=$votedtop[threadid]&boardid=$votedtop[boardid]&sid=$session[hash]\">$votedtop[topic]</a>";
    $votedrating = "$votedtop[votepoints]";
}
// Ende Top Bewertung
// Start des template aufrufs
eval ("\$top5threadstats = \"".$tpl->get("index_topfive")."\";");
// Ende templates aufruf
/* ############## USERONLINE ############## */
if($showuseronline==1) {
 $guestcount=0;
 $membercount=0;
 $useronlinebit = '';
 $result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' ORDER BY username ASC");
 while($row = $db->fetch_array($result)) {
  if($row['userid']==0) {
   $guestcount++;
   continue;
  }
  $membercount++;
  	  	if(!$row['invisible'] or ($row['invisible'] && $wbbuserdata['canuseacp'])) { 
  		if(isset($useronlinebit) && $useronlinebit != '') $useronlinebit .= ', ';
  		if (!$row['invisible']) {     eval ("\$useronlinebit .= \"".$tpl->get("index_useronline")."\";");
      } else { eval ("\$useronlinebit .= \"".$tpl->get("index_ghostonline")."\";");   }

  	}
 }
 $totaluseronline = $membercount+$guestcount;
 if($totaluseronline>$rekord) {
  $rekord=$totaluseronline;
  $rekordtime=time();
  $db->unbuffered_query("UPDATE bb".$n."_options SET value='$rekord' WHERE varname='rekord'",1);
  $db->unbuffered_query("UPDATE bb".$n."_options SET value='$rekordtime' WHERE varname='rekordtime'",1);
  require ("./acp/lib/class_options.php");
  $option=new options("acp/lib");
  $option->write();
 }
  $admincount=0; 
 $modcount=0;
 $smodcount=0;
 $user2count=0;

$adminonlinebit = '';
 $result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' AND bb".$n."_users.groupid = 1 ORDER BY username ASC");
 while($admin = $db->fetch_array($result)) {
  $admincount++;
  	if(!$admin['invisible']) {
  		if(isset($adminonlinebit) && $adminonlinebit != '') $adminonlinebit .= ', ';
  		eval ("\$adminonlinebit .= \"".$tpl->get("index_adminonline")."\";");
  	} 
  	  	} 
if($admincount == "0") {
eval ("\$adminonoff  = \"".$tpl->get("index_showuseronline_noff")."\";");
  } else {
eval ("\$adminonoff  = \"".$tpl->get("index_showuseronline_non")."\";");
 }
  	
 

  	
  	  	
  	  	$modonlinebit = '';
 $result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' AND bb".$n."_users.groupid = 3 ORDER BY username ASC");
 while($mod = $db->fetch_array($result)) {
 $modcount++;
  	if(!$mod['invisible']) {
  		if(isset($modonlinebit) && $modonlinebit != '') $modonlinebit .= ', ';
  		eval ("\$modonlinebit .= \"".$tpl->get("index_modonline")."\";");
  	} 
  	  	}
if($modcount == "0") {
eval ("\$modonoff  = \"".$tpl->get("index_showuseronline_noff")."\";");
  } else {
eval ("\$modonoff  = \"".$tpl->get("index_showuseronline_non")."\";");
 }



$smodonlinebit = '';
 $result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' AND bb".$n."_users.groupid = 2 ORDER BY username ASC");
 while($smod = $db->fetch_array($result)) {
 $smodcount++;
  	if(!$smod['invisible']) {
  		if(isset($smodonlinebit) && $smodonlinebit != '') $smodonlinebit .= ', ';
  		eval ("\$smodonlinebit .= \"".$tpl->get("index_smodonline")."\";");
  	} 
  	  	}

if($smodcount == "0") {
eval ("\$smodonoff  = \"".$tpl->get("index_showuseronline_noff")."\";");
  } else {
eval ("\$smodonoff  = \"".$tpl->get("index_showuseronline_non")."\";");
 }




$user2onlinebit = '';
 $result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' AND bb".$n."_users.groupid = 4 ORDER BY username ASC");
 while($user2 = $db->fetch_array($result)) {
 $user2count++;
  	if(!$user2['invisible']) {
  		if(isset($user2onlinebit) && $user2onlinebit != '') $user2onlinebit .= ', ';
  		eval ("\$user2onlinebit .= \"".$tpl->get("index_user2online")."\";");
  	} 
  	  	}

if($smodcount == "0") {
eval ("\$user2onoff  = \"".$tpl->get("index_showuseronline_noff")."\";");
  } else {
eval ("\$user2onoff  = \"".$tpl->get("index_showuseronline_non")."\";");
 }
 $rekorddate = formatdate($dateformat,$rekordtime);
 $rekordtime = formatdate($timeformat,$rekordtime);
 eval ("\$index_useronline = \"".$tpl->get("index_showuseronline")."\";");
}


if(!$wbbuserdata['userid']) {
 eval ("\$welcome = \"".$tpl->get("index_welcome")."\";");
 eval ("\$quicklogin = \"".$tpl->get("index_quicklogin")."\";");
}
else {
 if($user_info['avatarid'] && $showavatar==1 && $wbbuserdata['showavatars']==1) {
  $avatarname="images/avatars/avatar-$user_info[avatarid].$user_info[avatarextension]";
  $avatarwidth=$user_info['width'];
  $avatarheight=$user_info['height'];
  eval ("\$useravatar = \"".$tpl->get("avatar_image")."\";");
 }
 if($wbbuserdata['canusepms']==1 && $showpmonindex==1) {
  $counttotal=0; $countunread=0; $countnew=0;
  $result = $db->query("SELECT view, sendtime FROM bb".$n."_privatemessage WHERE deletepm <> 1 AND recipientid = '$wbbuserdata[userid]'");
  while($row=$db->fetch_array($result)) {
   $counttotal++;
   if($row['view']==0) {
    $countunread++;
    if($row['sendtime']>$wbbuserdata['lastvisit']) $countnew++;
   }
  }

  if($countnew>0) eval ("\$new_notnew = \"".$tpl->get("index_newpm")."\";");
  else eval ("\$new_notnew = \"".$tpl->get("index_nonewpm")."\";");
  eval ("\$index_pms = \"".$tpl->get("index_pms")."\";");
 }
 $currenttime=formatdate($timeformat,time());
 $toffset=ifelse($default_timezoneoffset>=0,"+").$default_timezoneoffset;
 $lastvisitdate = formatdate($dateformat,$wbbuserdata['lastvisit']);
 $lastvisittime = formatdate($timeformat,$wbbuserdata['lastvisit']);
 eval ("\$welcome = \"".$tpl->get("index_hello")."\";");
 if($wbbuserdata['canusepms']==1 && $showpmonindex==1) {
  $counttotal=0; $countunread=0; $countnew=0;
  $result = $db->query("SELECT view, sendtime FROM bb".$n."_privatemessage WHERE deletepm <> 1 AND recipientid = '$wbbuserdata[userid]'");
  while($row=$db->fetch_array($result)) {
   $counttotal++;
   if($row['view']==0) {
    $countunread++;
    if($row['sendtime']>$wbbuserdata['lastvisit']) $countnew++;
   }
  }

  if($countnew>0) eval ("\$new_notnew = \"".$tpl->get("index_newpm")."\";");
  else eval ("\$new_notnew = \"".$tpl->get("index_nonewpm")."\";");
  eval ("\$index_pms = \"".$tpl->get("index_pms")."\";");
 }
}

/* ############## USER HEUTE ############## */
$usertoday=0;
$usertodaybit='';
$result = $db->query("SELECT lastactivity, username, userid, invisible FROM bb".$n."_users ORDER BY lastactivity DESC");
while($row = $db->fetch_array($result)) {
 $zeit = date("dmY", $row['lastactivity']);
 $jetzt = date("dmY");
 $last = date('H:i:s',$row['lastactivity']);
 if(!$row['invisible'] && $zeit==$jetzt) {
  $usertoday++;
  if($usertoday=="1") {
  $war = 'war';
  $reg = 'registrierter';
  } else {
  $war = 'waren';
  $reg = 'registrierte';
  }
  if(isset($usertodaybit) && $usertodaybit != '') $usertodaybit .= ', ';
  eval ("\$usertodaybit .= \"".$tpl->get("index_useronline").' (zuletzt um '.$last.')'."\";");
 }
}
#### Anfang new since last visit ####
if($wbbuserdata['userid']) {
	$last_visit = ($wbbuserdata['lastvisit']);
	$newposts_frage = $db->query_first("SELECT COUNT(postid) as newposts FROM bb".$n."_posts WHERE posttime > ".$last_visit."");
	$new_posts = ($newposts_frage['newposts']);
	$newthreads_frage = $db->query_first("SELECT COUNT(threadid) as newthreads FROM bb".$n."_threads WHERE starttime > ".$last_visit."");
	$new_threads = ($newthreads_frage['newthreads']);
	$newusers_frage = $db->query_first("SELECT COUNT(userid) as newusers FROM bb".$n."_users WHERE regdate > ".$last_visit."");
	$new_users = ($newusers_frage['newusers']);
	$ntslv = '	<tr bgcolor="{tabletitlecolor}" id="tabletitle">
			<td colspan="6"><font face="Tahoma,Helvetica" size="1" color="{fontcolorsecond}"><b>Neues seit dem letzten Besuch</b></font></td>
		</tr>
			<tr bgcolor="{tablecolora}" id="tablea">
			<td colspan="6"><font face="Tahoma,Helvetica" size="1">Neue Mitglieder: <b><a href="new_since_last_visit.php?mode=new_users">'.$new_users.'</a></b><br>
								 Neue Posts: <b><a href="new_since_last_visit.php?mode=new_posts">'.$new_posts.'</a></b><br>
								 Neue Themen: <b><a href="new_since_last_visit.php?mode=new_threads">'.$new_threads.'</a></b></font>
			</td>
			</tr>';

} else {
	$ntslv = "";
}
#### ENDE new since last visit ####
 #geburtstage
 $currentdate = formatdate("m-d", time());
 $currentyear = intval(formatdate("Y", time()));
 $result = $db->unbuffered_query("SELECT userid, username, birthday FROM bb".$n."_users WHERE birthday LIKE '%-$currentdate' ORDER BY username ASC");
 while($row = $db->fetch_array($result)) {
  $birthyear = intval(substr($row['birthday'], 0, 4));
  $age = $currentyear-$birthyear;
  if($age<1 || $age>200) $age="";
  else $age="&nbsp;($age)";
  eval("\$index_birthdaybit .= \"".$tpl->get("index_birthdaybit")."\";"); 
 } 
 if($index_birthdaybit!="") eval ("\$birthday = \"".$tpl->get("index_birthday")."\";");
 #geburtstage ende
eval("\$tpl->output(\"".$tpl->get("index")."\");");
?>


Und hier die search.php :
code:
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:
<?php
$filename="search.php";

require("./global.php");

if(!$wbbuserdata['canusesearch']) access_error();

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();
 }
 $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,
   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']]!=1 && $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")."\";");

   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="";
   $attachments="";

   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($threadrating, round($avarage));
   }
   else $threadrating="&nbsp;";

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

   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), -1, PREG_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]==1 || 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==0 && $addsplit=="AND") {
     unset($wordids);
     break;
    }


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

   if($count_bad>0 && $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")."\");");
 }
}
?>


Schon scheisse wenn man sich nich so gut damit ausskennt :/

Aber hammer das du immer am Start bist !!
Beckebans
Zitat:
Original von Beckebans
...

PS: Die ersten beiden Code-Zeilen sind vertauscht.



Such die Zeile mal mit dieser Info Augenzwinkern
SnakeBlood
Zitat:
Original von Beckebans
Zitat:
Original von Beckebans
...

PS: Die ersten beiden Code-Zeilen sind vertauscht.



Such die Zeile mal mit dieser Info Augenzwinkern


Kommt davon wenn man das Fenster schon aufhatte und dann ein Telefonat dazwischen funkt und man absendet smile

Aber auch wenn ich das mache bekomme ich einen Fehler , der sieht dann so aus :


Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 3228401 bytes) in /home/htdocs/web2/html/wbblite/acp/lib/class_tpl_file.php on line 66
MrMind
Habs überarbeitet:

Diese Zeile:

php:
1:
$thread_q $db->query("SELECT * FROM bb".$n."_threads WHERE important LIKE 1");


in diese Zeile hier:

php:
1:
$thread_q $db->query("SELECT t.*, b.boardid FROM bb".$n."_threads t, bb".$n."_boards b LEFT JOIN bb".$n."_permissions p ON(p.boardid = b.boardid AND p.groupid = ".$wbbuserdata['groupid']." AND p.boardpermission=1) WHERE important LIKE 1");


ändern

sowie diese Zeile:

php:
1:
$thread_q $db->query("SELECT * FROM bb".$n."_threads WHERE important LIKE 2");


in diese Zeile hier:

php:
1:
$thread_q $db->query("SELECT t.*, b.boardid FROM bb".$n."_threads t, bb".$n."_boards b LEFT JOIN bb".$n."_permissions p ON(p.boardid = b.boardid AND p.groupid = ".$wbbuserdata['groupid']." AND p.boardpermission=1) WHERE important LIKE 2");


Das sollte Funktionieren.

@SnakeBlood

Habe einfach die Zeilen genommen die du aus der Anleitung gepostet hast Augenzwinkern

Die müssen bei dir vorhanden sein wenn du das richtig eingebaut hast Augenzwinkern

Mfg
MrMind
SnakeBlood
Geht auch alles beim Einbau aber wenn ichs nach der neuen Anleitung jetzt mache sagt der :


Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 3227904 bytes) in /home/htdocs/web2/html/wbblite/acp/lib/class_tpl_file.php on line 80


Was soll das schon wieder ? Da hatte ich doch nix dran geändert !

Die Zeile aus der class... sieht so aus :

$template = str_replace($tmp,$this->images[$matches[2][$j]],$template);
MrMind
Wahrscheinlich liegt das daran, weil du zu viele Wichtige Themen und Ankündigungen hast, das der Server dadurch überlastet wird mit meiner Abfrage.

Mh muss ich selber erstmal testen, bitte in der Zeit wieder ausbauen.

Mfg
MrMind
SnakeBlood
Stimmt es sind sehr viele Wichtige dabei !
Ich bau ihn aber nicht aus da er ja sehr interessant ist und die User die Beiträge ja trotzdem nicht lesen können , halt nur wie das Thema heisst !

Kannst ja mal danach gucken , das wäre noch cool wenn das direkt weg wäre , auch bei vielen wichtigen Themen & Ankündigungen !
Beckebans
Zitat:
Original von Beckebans
Hi, ich hab das hier immer mal mitgelesen und hab die Änderung von MrMind gerade eingebaut. Wenn ich jetzt aber auf "Alle wichtigen Themen" klicke werden die wichtigen Themen 124 mal aufgelistet. Die Themen, die nicht zu sehen sein sollten erscheinen trotzdem.

Bsp:
Vorher wurden 4 Themen angezeigt. 3 normale und eine, die weg sollte. Diese 4 Themen werden jetzt also immer wieder untereinander angezeigt.
Oben links steht: Insgesammt 496 Themen gefunden



Hier hat sich ja jetzt nen paar Tage lang nichts getan. Ist das oben vielleicht untergegangen oder gibts dafür keine Lösung?
Wäre schön, wenn sich wer meldet und sagen könnte wie es aussieht.