rellek[org]

Zurück   rellek[org] > powered by rellek > wbb-stuff > hacks/styles/hilfe > hacks von rellek


hacks von rellek Alles zum wBB von rellek.

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (Permalink)  
Alt 01.01.2005, 16:41
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

Ähnliche Themen von rellek (01.01.2005, 16:41)


Name: Ähnliche Themen
Version: 1.0
Für wBB-Version: 2.2
Getestet mit: 2.2.1

Beschreibung: Mit diesem Hack werden zu jedem Thema 5 ähnliche Themen gesucht. Dazu wird
die MySQL-Bedingung LIKE verwendet, d.h. wenn die Anzeige "komisch" oder
unsauber funktioniert, dann ist MySQL schuld.
Dieser Hack ist im Gegensatz zu den meisten anderen Hacks, die ähnliches
leisten, sehr sparsam gecodet. Es für die Abfrage nur ein zusätzlicher SQL-
Query nötig, ein weiterer kommt hinzu, wenn der Permission-Cache nicht gesetzt
ist, um die Foren ausfindig zu machen, in denen gesucht wird.
Foren, zu denen man keine Berechtigung hat, werden, genauso wie passwortgeschützte
Foren, von der Suche nach ähnlichen Themen ausgeschlossen, sodass niemand etwas
sieht, was er nicht sehen darf.

MySQL5-Probleme? Hier klicken: Ähnliche Themen

Demo: Im Anhang
Copyright: (c) 2005 by rellek
Disclaimer: Keine Haftung für irgendwelche Schäden am Board. Fehler sind natürlich nicht ausgeschlossen

---

Bekannte Fehler: -
Updates und Bugfixes: -
Miniaturansicht angehängter Grafiken
Ähnliche Themen-demo.png  
Angehängte Dateien
Dateityp: zip aehnliche_themen_wBB22.zip (3,6 KB, 83x aufgerufen)
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #2 (Permalink)  
Alt 06.01.2005, 06:54
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (06.01.2005, 06:54)


Servus Rellek,

der Hack hat einen kleinen Haken:

er checkt nur das erste Wort und läuft nicht durchs ganze Topic

ansonsten


PS: ich war mal so frei und habe für mich wie für die QReply ne Option zum ein und ausschalten angefangen zu basteln. Wenn Du haben möchtest, schreien
Mit Zitat antworten
  #3 (Permalink)  
Alt 06.01.2005, 07:39
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (06.01.2005, 07:39)


er checkt das ganze topic.

in einer späteren version wird es diese option geben und die suche nach ähnlichen topics wird optimiert.
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #4 (Permalink)  
Alt 06.01.2005, 14:15
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (06.01.2005, 14:15)


leider nicht

Themen Ähnliche hmm?

erkennt er nicht
Mit Zitat antworten
  #5 (Permalink)  
Alt 06.01.2005, 14:25
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (06.01.2005, 14:25)


Ich arbeite grad an einer besseren technologie...
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #6 (Permalink)  
Alt 06.01.2005, 14:28
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (06.01.2005, 14:28)


dann warte ich mal gespannt

gehst diesmal über die wordlist?
Mit Zitat antworten
  #7 (Permalink)  
Alt 06.01.2005, 14:29
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (06.01.2005, 14:29)


jop.

also besser gesagt über die bad-wordlist - sonst wirds noch ein query mehr, das will ich vermeiden. beta-version der neuen version dann hier als live-demo.
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #8 (Permalink)  
Alt 06.01.2005, 15:14
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (06.01.2005, 15:14)


Wer am Beta-Test der neuen Version teilnehmen möchte, der ersetzt bitte den längeren Abschnitt zwischen den beiden
Code:
/* Ähnliche Themen */
und
Code:
/* Ähnliche Themen Ende */
mit:
Code:
/* Ähnlich Themen */
function GetAccessableForums() {
	global $db, $n, $wbbuserdata, $boardcache;
	
	if (!isset($boardcache) || !is_array($boardcache)) $boardcache = array();
	$result = $db->query("SELECT boardid,boardorder,parentid,parentlist FROM bb".$n."_boards ORDER BY parentid ASC, boardorder ASC");
	while ($row = $db->fetch_array($result)) {
		$boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;
	}

	$boardpermissions = getPermissions();
	$boardids = '';
	foreach ($boardcache as $key => $val) {
		foreach ($val as $key2 => $val2) {
			foreach ($val2 as $row) if ((!isset($boardpermissions[$row['boardid']]['can_view_board']) || $boardpermissions[$row['boardid']]['can_view_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_enter_board']) || $boardpermissions[$row['boardid']]['can_enter_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_read_thread']) || $boardpermissions[$row['boardid']]['can_read_thread'] != 0)) $boardids .= ",".$row['boardid'];
		}	
	}
	return $boardids;
}
$ttopic = str_replace("."," ",$threadtopic);
$ttopic = str_replace("!"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("/"," ",$ttopic);
$ttopic = str_replace("§"," ",$ttopic);
$ttopic = str_replace("$"," ",$ttopic);
$ttopic = str_replace("%"," ",$ttopic);
$ttopic = str_replace("&"," ",$ttopic);
$ttopic = str_replace("("," ",$ttopic);
$ttopic = str_replace(")"," ",$ttopic);
$ttopic = str_replace("="," ",$ttopic);
$ttopic = str_replace("\\"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = explode(" ",$ttopic);
$badwordlist = explode("\n",$badsearchwords);
$y = count($ttopic);
if($y>1) {
  foreach($ttopic as $tt) {
  	$x++;
  	if(!in_array($tt, $badwordlist)) {
  		if($x>1 && (strlen($tt)>$minwordlength && strlen($tt)<$maxwordlength)) $like_string .= " OR t.topic LIKE ";
  		if(strlen($tt)>$minwordlength && strlen($tt)<$maxwordlength) $like_string .= "'%".$tt."%'";
  }
}
} else $like_string = "'%$threadtopic%'";
if($like_string) {
	$similar = $db->query("SELECT
                            t.threadid, t.boardid, x.title, x.boardid, t.prefix, t.topic, t.starttime, t.starterid, t.starter, t.lastposttime, t.lastposterid, t.lastposter, t.replycount, t.views, t.attachments, t.closed, t.important, t.pollid
                            FROM bb".$n."_threads t, bb".$n."_boards x
                            LEFT JOIN bb".$n."_boards b ON (t.boardid=b.boardid)
                            WHERE t.visible='1'
                            AND t.closed <> 3
                            AND t.threadid <> $threadid
                            AND b.password=''
                            AND t.boardid=x.boardid
                            AND t.boardid IN (0".GetAccessableForums().")
                            AND (t.topic LIKE ".$like_string.")
                            ORDER BY t.lastposttime DESC
LIMIT 0, 5;");
	}
if($like_string && $db->num_rows($similar)) {
	$i = "0";
	while ($row = $db->fetch_array($similar)) {
		$i++;
		$tdclass = getone($i, "tablea", "tableb");
		$started = formatdate($wbbuserdata['dateformat'], $row['starttime'],1);
		$started .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['starttime'])."</span>";
		$lastreply = formatdate($wbbuserdata['dateformat'], $row['lastposttime'],1);
		$lastreply .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['lastposttime'])."</span>";
		if ($row['replycount'] >= 1000) $row['replycount'] = number_format($row['replycount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if ($row['views'] >= 1000) $row['views'] = number_format($row['views'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if (strlen($row['topic']) > 60) $row['topic'] = substr($row['topic'], 0, 54).' [...]';
		eval("\$similar_thread_bit .= \"".$tpl->get("thread_similarthread_bit")."\";");
	}
	eval("\$similar_thread = \"".$tpl->get("thread_similarthread")."\";");
}
/* Ähnliche Themen Ende */
Auftretende Bugs bitte melden !
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #9 (Permalink)  
Alt 06.01.2005, 21:03
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (06.01.2005, 21:03)


Hmm wenn ein doppe ee oder uu oder mm .. etc. im Wort vorkommt, dann:

Code:
Database error in WoltLab Burning Board (2.2.1): Invalid SQL: SELECT t.threadid, t.boardid, x.title, x.boardid, t.prefix, t.topic, t.starttime, t.starterid, t.starter, t.lastposttime, t.lastposterid, t.lastposter, t.replycount, t.views, t.attachments, t.closed, t.important, t.pollid FROM bb1_threads t, bb1_boards x LEFT JOIN bb1_boards b ON (t.boardid=b.boardid) WHERE t.visible='1' AND t.closed <> 3 AND t.threadid <> 630 AND b.password='' AND t.boardid=x.boardid AND t.boardid IN (0,39,1,6,10,47,16,23,33,2,7,41,8,13,51,28,54,53,55,29,12,30,42,14,52,11,15,17,50,43,44,24,46,25,27,37,56,40,32,58,36,34,35,57,48,49) AND (t.topic LIKE OR t.topic LIKE '%Feed%' OR t.topic LIKE '%Under%') ORDER BY t.lastposttime DESC LIMIT 0, 5;
mysql error: You have an error in your SQL syntax near 'OR t.topic LIKE '%Feed%' OR t.topic LIKE '%Under%') ' at line 11
Mit Zitat antworten
  #10 (Permalink)  
Alt 07.01.2005, 05:40
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (07.01.2005, 05:40)


Kannst du das hier bitte reproduzieren?
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #11 (Permalink)  
Alt 07.01.2005, 07:33
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (07.01.2005, 07:33)


Six Feed Under
Mit Zitat antworten
  #12 (Permalink)  
Alt 07.01.2005, 11:23
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (07.01.2005, 11:23)


OK, danke für den Test.

Das liegt daran, dass das erste Wort drei Zeichen hat und deswegen beim Suchergebnis nach einem leeren LIKE gesucht wird.
Ich mach nachher nen Fix dafür, bin grad in der Schule....

MfG
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #13 (Permalink)  
Alt 07.01.2005, 14:25
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (07.01.2005, 14:25)


Probiers mal damit:

Code:
/* Ähnlich Themen */
function GetAccessableForums() {
	global $db, $n, $wbbuserdata, $boardcache;
	
	if (!isset($boardcache) || !is_array($boardcache)) $boardcache = array();
	$result = $db->query("SELECT boardid,boardorder,parentid,parentlist FROM bb".$n."_boards ORDER BY parentid ASC, boardorder ASC");
	while ($row = $db->fetch_array($result)) {
		$boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;
	}

	$boardpermissions = getPermissions();
	$boardids = '';
	foreach ($boardcache as $key => $val) {
		foreach ($val as $key2 => $val2) {
			foreach ($val2 as $row) if ((!isset($boardpermissions[$row['boardid']]['can_view_board']) || $boardpermissions[$row['boardid']]['can_view_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_enter_board']) || $boardpermissions[$row['boardid']]['can_enter_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_read_thread']) || $boardpermissions[$row['boardid']]['can_read_thread'] != 0)) $boardids .= ",".$row['boardid'];
		}	
	}
	return $boardids;
}
$ttopic = str_replace("."," ",$threadtopic);
$ttopic = str_replace("!"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("/"," ",$ttopic);
$ttopic = str_replace("§"," ",$ttopic);
$ttopic = str_replace("$"," ",$ttopic);
$ttopic = str_replace("%"," ",$ttopic);
$ttopic = str_replace("&"," ",$ttopic);
$ttopic = str_replace("("," ",$ttopic);
$ttopic = str_replace(")"," ",$ttopic);
$ttopic = str_replace("="," ",$ttopic);
$ttopic = str_replace("\\"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("-"," ",$ttopic);
$ttopic = str_replace("*"," ",$ttopic);
$ttopic = str_replace("+"," ",$ttopic);
$ttopic = str_replace("#"," ",$ttopic);
$ttopic = str_replace("_"," ",$ttopic);
$ttopic = str_replace(","," ",$ttopic);
$ttopic = str_replace(":"," ",$ttopic);
$ttopic = str_replace(";"," ",$ttopic);
$ttopic = str_replace("<"," ",$ttopic);
$ttopic = str_replace(">"," ",$ttopic);
$ttopic = str_replace("|"," ",$ttopic);
$ttopic = explode(" ",$ttopic);
$badwordlist = explode("\n",$badsearchwords);
$y = count($ttopic);
if($y>1) {
  foreach($ttopic as $tt) {
  	if(!in_array($tt, $badwordlist)) {
  		if(strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength) $x++;
  		if($x>1 && (strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength)) $like_string .= " OR t.topic LIKE ";
  		if(strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength) $like_string .= "'%".$tt."%'";
  }
}
} else $like_string = "'%$threadtopic%'";
if($like_string) {
	$similar = $db->query("SELECT
											t.threadid, t.boardid, x.title, x.boardid, t.prefix, t.topic, t.starttime, t.starterid, t.starter, t.lastposttime, t.lastposterid, t.lastposter, t.replycount, t.views, t.attachments, t.closed, t.important, t.pollid
											FROM bb".$n."_threads t, bb".$n."_boards x
											LEFT JOIN bb".$n."_boards b ON (t.boardid=b.boardid)
											WHERE t.visible='1'
											AND t.closed <> 3
											AND t.threadid <> $threadid
											AND b.password=''
											AND t.boardid=x.boardid
											AND t.boardid IN (0".GetAccessableForums().")
											AND (t.topic LIKE ".$like_string.")
											ORDER BY t.lastposttime DESC
											LIMIT 0, 5;");
	}
if($like_string && $db->num_rows($similar)) {
	$i = "0";
	while ($row = $db->fetch_array($similar)) {
		$i++;
		$tdclass = getone($i, "tablea", "tableb");
		$started = formatdate($wbbuserdata['dateformat'], $row['starttime'],1);
		$started .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['starttime'])."</span>";
		$lastreply = formatdate($wbbuserdata['dateformat'], $row['lastposttime'],1);
		$lastreply .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['lastposttime'])."</span>";
		if ($row['replycount'] >= 1000) $row['replycount'] = number_format($row['replycount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if ($row['views'] >= 1000) $row['views'] = number_format($row['views'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if (strlen($row['topic']) > 60) $row['topic'] = substr($row['topic'], 0, 54).' [...]';
		eval("\$similar_thread_bit .= \"".$tpl->get("thread_similarthread_bit")."\";");
	}
	eval("\$similar_thread = \"".$tpl->get("thread_similarthread")."\";");
}
/* Ähnliche Themen Ende */
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #14 (Permalink)  
Alt 07.01.2005, 14:39
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (07.01.2005, 14:39)


selbe Fehlermeldung.. hmmm
Mit Zitat antworten
  #15 (Permalink)  
Alt 07.01.2005, 14:45
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (07.01.2005, 14:45)


stell ich die minimale Wortlänge in der ACP/Suchfunktion auf "0", gehts.
Mit Zitat antworten
  #16 (Permalink)  
Alt 07.01.2005, 14:50
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (07.01.2005, 14:50)


ich hab oben editiert und nicht geseghen, dass du on warst, kannst du den code nocheinmal einfügen?

ich hab minimum-wortlänge auf drei und bei mir gehts (siehe test-forum)
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #17 (Permalink)  
Alt 07.01.2005, 14:56
Neuer Benutzer
 
Registriert seit: Sep 2004
Beiträge: 18
Standard

AW: Ähnliche Themen von CSchulle (07.01.2005, 14:56)


Funzt jetzt
auch die Sonderzeichen machen keine Probleme
Mit Zitat antworten
  #18 (Permalink)  
Alt 07.01.2005, 14:57
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (07.01.2005, 14:57)


Das freut mich.

Bitte trotzdem weitertesten :-)
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #19 (Permalink)  
Alt 09.01.2005, 06:21
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (09.01.2005, 06:21)


Neuer Fix.

Code:
/* Ähnlich Themen */
function GetAccessableForums() {
	global $db, $n, $wbbuserdata, $boardcache;
	
	if (!isset($boardcache) || !is_array($boardcache)) $boardcache = array();
	$result = $db->query("SELECT boardid,boardorder,parentid,parentlist FROM bb".$n."_boards ORDER BY parentid ASC, boardorder ASC");
	while ($row = $db->fetch_array($result)) {
		$boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;
	}

	$boardpermissions = getPermissions();
	$boardids = '';
	foreach ($boardcache as $key => $val) {
		foreach ($val as $key2 => $val2) {
			foreach ($val2 as $row) if ((!isset($boardpermissions[$row['boardid']]['can_view_board']) || $boardpermissions[$row['boardid']]['can_view_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_enter_board']) || $boardpermissions[$row['boardid']]['can_enter_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_read_thread']) || $boardpermissions[$row['boardid']]['can_read_thread'] != 0)) $boardids .= ",".$row['boardid'];
		}	
	}
	return $boardids;
}

/* Unset Used Vars To Avoid Hacking Attempts */
unset($similar_thread_bit);
unset($like_string);

$ttopic = str_replace("."," ",$threadtopic);
$ttopic = str_replace("!"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("/"," ",$ttopic);
$ttopic = str_replace("§"," ",$ttopic);
$ttopic = str_replace("$"," ",$ttopic);
$ttopic = str_replace("%"," ",$ttopic);
$ttopic = str_replace("&"," ",$ttopic);
$ttopic = str_replace("("," ",$ttopic);
$ttopic = str_replace(")"," ",$ttopic);
$ttopic = str_replace("="," ",$ttopic);
$ttopic = str_replace("\\"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("-"," ",$ttopic);
$ttopic = str_replace("*"," ",$ttopic);
$ttopic = str_replace("+"," ",$ttopic);
$ttopic = str_replace("#"," ",$ttopic);
$ttopic = str_replace("_"," ",$ttopic);
$ttopic = str_replace(","," ",$ttopic);
$ttopic = str_replace(":"," ",$ttopic);
$ttopic = str_replace(";"," ",$ttopic);
$ttopic = str_replace("<"," ",$ttopic);
$ttopic = str_replace(">"," ",$ttopic);
$ttopic = str_replace("|"," ",$ttopic);
$ttopic = str_replace("~"," ",$ttopic);
$ttopic = str_replace("'"," ",$ttopic);
$ttopic = str_replace('"',' ',$ttopic);
$ttopic = explode(" ",$ttopic);
$badwordlist = explode("\n",$badsearchwords);
$y = count($ttopic);
if($y>1) {
  foreach($ttopic as $tt) {
  	if(!in_array($tt, $badwordlist)) {
  		if(strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength) $x++;
  		if($x>1 && (strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength)) $like_string .= " OR t.topic LIKE ";
  		if(strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength) $like_string .= "'%".$tt."%'";
  }
}
} else $like_string = "'%$threadtopic%'";
if($like_string) {
	$similar = $db->query("SELECT
                      t.threadid, t.boardid, x.title, x.boardid, t.prefix, t.topic, t.starttime, t.starterid, t.starter, t.lastposttime, t.lastposterid, t.lastposter, t.replycount, t.views, t.attachments, t.closed, t.important, t.pollid
                      FROM bb".$n."_threads t, bb".$n."_boards x
                      LEFT JOIN bb".$n."_boards b ON (t.boardid=b.boardid)
                      WHERE t.visible='1'
                      AND t.closed <> 3
                      AND t.threadid <> $threadid
                      AND b.password=''
                      AND t.boardid=x.boardid
                      AND t.boardid IN (0".GetAccessableForums().")
                      AND (t.topic LIKE ".$like_string.")
                      ORDER BY t.lastposttime DESC
                      LIMIT 0, 5;");
	}
if($like_string && $db->num_rows($similar)) {
	$i = "0";
	while ($row = $db->fetch_array($similar)) {
		$i++;
		$tdclass = getone($i, "tablea", "tableb");
		$started = formatdate($wbbuserdata['dateformat'], $row['starttime'],1);
		$started .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['starttime'])."</span>";
		$lastreply = formatdate($wbbuserdata['dateformat'], $row['lastposttime'],1);
		$lastreply .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['lastposttime'])."</span>";
		if ($row['replycount'] >= 1000) $row['replycount'] = number_format($row['replycount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if ($row['views'] >= 1000) $row['views'] = number_format($row['views'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if (strlen($row['topic']) > 60) $row['topic'] = substr($row['topic'], 0, 54).' [...]';
		$row['topic'] = htmlconverter($row['topic']);
		eval("\$similar_thread_bit .= \"".$tpl->get("thread_similarthread_bit")."\";");
	}
	eval("\$similar_thread = \"".$tpl->get("thread_similarthread")."\";");
}
/* Ähnliche Themen Ende */
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #20 (Permalink)  
Alt 11.02.2005, 14:25
[inaktiv]
 
Registriert seit: Feb 2005
Beiträge: 3
Standard

AW: Ähnliche Themen von Anubis (11.02.2005, 14:25)


Hi rellek,

erstmal, vielen dank für das hammergeile script, einbau hat ohne probleme
funktioniert und auch der neue fix ging bei mir ohne probleme, bugs hab ich
auch noch keine gefunden.

Hätte nur kurz ne Frage an dich, und zwar wollte ich wissen ob es möglich ist,
das das Ähnliche Themen script nur bestimmte sektionen nach ähnlichen
themen durchsucht, nicht alle sektionen und wenn ja, wie ich sowas am besten
einbauen könnte.

Wäre hammergeil wenn du mir kurz erklären könntest wie ich sowas einbaue,
falls sowas möglich ist,
big thx schonmal,

Anubis
Mit Zitat antworten
  #21 (Permalink)  
Alt 11.02.2005, 14:33
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (11.02.2005, 14:33)


Zur Zeit wird nur nach Foren gesucht, in denen man das Recht hat auch Themen zu lesen.

Du könntest es höchstens so einstellen, dass nur in bestimmten Foren gesucht wird (was zwar eine DB-Abfrage spart, aber nicht nach Rechten prüft).

Bei Interesse sag ich dir, wie.
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #22 (Permalink)  
Alt 11.02.2005, 14:40
[inaktiv]
 
Registriert seit: Feb 2005
Beiträge: 3
Standard

AW: Ähnliche Themen von Anubis (11.02.2005, 14:40)


Zitat:


Original von rellek
Zur Zeit wird nur nach Foren gesucht, in denen man das Recht hat auch Themen zu lesen.

Du könntest es höchstens so einstellen, dass nur in bestimmten Foren gesucht wird (was zwar eine DB-Abfrage spart, aber nicht nach Rechten prüft).

Bei Interesse sag ich dir, wie.
Das wäre echt cool, die prüfung nach rechten ist für mich eh überflüssig da bei
mir alle sektionen von allen usern angesehen werden können.

Jo, wäre sehr sehr nett, wenn du mir da weiterhelfen könntest, thx!
Mit Zitat antworten
  #23 (Permalink)  
Alt 11.02.2005, 14:47
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (11.02.2005, 14:47)


OK, bei der SQL-Abfrage (was mit $db->query losgeht), steht u.a. folgendes:
Code:
AND t.boardid IN (0".GetAccessableForums().")
das änderst du in:
Code:
AND t.boardid IN (0,x,y,...,n)
und anstatt "x,y,...,n" schreibst du die Board-IDs der Foren, in denen gesucht werden soll.
Die IDs bekommst du aus dem Link. z.B. hier das wBB-Hack-Forum hat folgenden Link:
http://board.rellek.org/board.php?boardid=129
Und da ist 129 die Zahl, die da rein muss usw.. Die Zahlen einfach mit Komma abtrennen.
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
  #24 (Permalink)  
Alt 11.02.2005, 15:04
[inaktiv]
 
Registriert seit: Feb 2005
Beiträge: 3
Standard

AW: Ähnliche Themen von Anubis (11.02.2005, 15:04)


Jep, habs gerad reingebaut und hat geklappt, big thx für die schnelle hilfe
Mit Zitat antworten
  #25 (Permalink)  
Alt 11.04.2006, 08:48
Benutzerbild von rellek
dokumentat0r
 
Registriert seit: Apr 2002
Ort: 192.168.0.3
Beiträge: 12 368
Standard

AW: Ähnliche Themen von rellek (11.04.2006, 08:48)


Für alle mit mySQL 5-Problemen!!!

Ersetze die Codestelle in der thread.php damit:
Code:
/* Ähnliche Themen */
function GetAccessableForums() {
	global $db, $n, $wbbuserdata, $boardcache;
	
	if (!isset($boardcache) || !is_array($boardcache)) $boardcache = array();
	$result = $db->query("SELECT boardid,boardorder,parentid,parentlist FROM bb".$n."_boards ORDER BY parentid ASC, boardorder ASC");
	while ($row = $db->fetch_array($result)) {
		$boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;
	}

	$boardpermissions = getPermissions();
	$boardids = '';
	foreach ($boardcache as $key => $val) {
		foreach ($val as $key2 => $val2) {
			foreach ($val2 as $row) if ((!isset($boardpermissions[$row['boardid']]['can_view_board']) || $boardpermissions[$row['boardid']]['can_view_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_enter_board']) || $boardpermissions[$row['boardid']]['can_enter_board'] != 0) && (!isset($boardpermissions[$row['boardid']]['can_read_thread']) || $boardpermissions[$row['boardid']]['can_read_thread'] != 0)) $boardids .= ",".$row['boardid'];
		}	
	}
	return $boardids;
}

/* Unset Used Vars To Avoid Hacking Attempts */
unset($similar_thread_bit);
unset($like_string);

$ttopic = str_replace("."," ",$threadtopic);
$ttopic = str_replace("!"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("/"," ",$ttopic);
$ttopic = str_replace("§"," ",$ttopic);
$ttopic = str_replace("$"," ",$ttopic);
$ttopic = str_replace("%"," ",$ttopic);
$ttopic = str_replace("&"," ",$ttopic);
$ttopic = str_replace("("," ",$ttopic);
$ttopic = str_replace(")"," ",$ttopic);
$ttopic = str_replace("="," ",$ttopic);
$ttopic = str_replace("\\"," ",$ttopic);
$ttopic = str_replace("?"," ",$ttopic);
$ttopic = str_replace("-"," ",$ttopic);
$ttopic = str_replace("*"," ",$ttopic);
$ttopic = str_replace("+"," ",$ttopic);
$ttopic = str_replace("#"," ",$ttopic);
$ttopic = str_replace("_"," ",$ttopic);
$ttopic = str_replace(","," ",$ttopic);
$ttopic = str_replace(":"," ",$ttopic);
$ttopic = str_replace(";"," ",$ttopic);
$ttopic = str_replace("<"," ",$ttopic);
$ttopic = str_replace(">"," ",$ttopic);
$ttopic = str_replace("|"," ",$ttopic);
$ttopic = str_replace("~"," ",$ttopic);
$ttopic = str_replace("'"," ",$ttopic);
$ttopic = str_replace('"',' ',$ttopic);
$ttopic = explode(" ",$ttopic);
$badwordlist = explode("\n",$badsearchwords);
$y = count($ttopic);
if($y>1) {
  foreach($ttopic as $tt) {
  	if(!in_array($tt, $badwordlist)) {
  		if(strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength) $x++;
  		if($x>1 && (strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength)) $like_string .= " OR t.topic LIKE ";
  		if(strlen($tt)>=$minwordlength && strlen($tt)<=$maxwordlength) $like_string .= "'%".$tt."%'";
  }
}
} else $like_string = "'%$threadtopic%'";
if($like_string) {
	$similar = $db->query("SELECT
                      t.threadid, t.boardid, x.title, x.boardid, t.prefix, t.topic, t.starttime, t.starterid, t.starter, t.lastposttime, t.lastposterid, t.lastposter, t.replycount, t.views, t.attachments, t.closed, t.important, t.pollid
                      FROM bb".$n."_threads t, bb".$n."_boards x
                      WHERE t.visible='1'
                      AND t.closed <> 3
                      AND t.threadid <> $threadid
                      AND x.password=''
                      AND t.boardid=x.boardid
                      AND t.boardid IN (0".GetAccessableForums().")
                      AND (t.topic LIKE ".$like_string.")
                      ORDER BY t.lastposttime DESC
                      LIMIT 0, 5;");
	}
if($like_string && $db->num_rows($similar)) {
	$i = "0";
	while ($row = $db->fetch_array($similar)) {
		$i++;
		$tdclass = getone($i, "tablea", "tableb");
		$started = formatdate($wbbuserdata['dateformat'], $row['starttime'],1);
		$started .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['starttime'])."</span>";
		$lastreply = formatdate($wbbuserdata['dateformat'], $row['lastposttime'],1);
		$lastreply .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['lastposttime'])."</span>";
		if ($row['replycount'] >= 1000) $row['replycount'] = number_format($row['replycount'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if ($row['views'] >= 1000) $row['views'] = number_format($row['views'], 0, "", $lang->get("LANG_GLOBAL_THOUSANDS_SEP"));
		if (strlen($row['topic']) > 60) $row['topic'] = substr($row['topic'], 0, 54).' [...]';
		$row['topic'] = htmlconverter($row['topic']);
		eval("\$similar_thread_bit .= \"".$tpl->get("thread_similarthread_bit")."\";");
	}
	eval("\$similar_thread = \"".$tpl->get("thread_similarthread")."\";");
}
/* Ähnliche Themen Ende */
__________________
...gehen Sie bitte weiter, hier gibt es nichts zu sehen | Diskussion über soziale Software? | Pieps, pieps | Horst | Murat | Achmed | Knut II.

Code:
cyberdyne:~# init 0
init: Ach leck mich am Netzteil!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
addon, burning board, themen, wbb, wbb 2.2, ähnlich, ähnliche themen

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[2.3] Ähnliche Themen rellek hacks von rellek 122 29.03.2009 12:07
[2.1] Ähnliche Themen rellek hacks von rellek 13 26.10.2007 09:23
Themen Ähnliche hmm? CSchulle Test- und Spam-Forum 1 06.01.2005 15:09


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:57 Uhr.


Powered by vBulletin® Version 3.8.4 (Deutsch)
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Template-Modifikationen durch TMS