Seite 1 von 2

Habe einen bedankomat mod gefunden

Verfasst: 07.10.2002 17:48
von Gast
Hi leute.

Ich habe einen bedankomat mod gefunden.
Er ist eigendlich für ein anderes Boardsystem.
Es sind 2 dateien, vielleicht kann es ja einer übersetzten.

hier die erste.

install-thx.php

Code: Alles auswählen

<?php
	include "_data.inc.php";
	mysql_connect ($mysqlhost, $mysqluser, $mysqlpassword);
	mysql_select_db ($mysqldb);

	$x1 = mysql_query ("create table bb".$n."_thanx(threadid int(11) not null default '0',userid int(11) not null default '0')");
	$x2 = mysql_query ("ALTER TABLE bb".$n."_threads ADD 'thx' INT(1) NOT NULL");

	echo "Update ausgeführt...";
	if (mysql_error()) echo "<b>MySQL Fehler: " . mysql_error();
?>
Und hier die zeite:

Code: Alles auswählen

"Bedankomat"-Hack 1.1

nach dem Posten in einem Forum antwortet postet direkt danach
ein "Bot" bei dem man sich für den oberen Beitrag bedanken kann

Ideen für 

Warnung: Bitte Backup machen, da frühe Beta-Version

Zuerst erstellt man einen neuen User unter dem "Bot-Namen", ändert die Signatur, etc. nach belieben.

Damit der Bot andere Sterne bekommt erstellt man eine neue Gruppe
und einen neuen Rang mit beliebigen Namen und fügt den Bot in diese Gruppe hinzu.


### newthread.php ###
1)suche:
---
$ride = getLastPost($user_id,4);
---
danach einfügen: (Einstellungen gegebenen falls verändern)
---
// BoardID`s, bei denen der Bot nicht posten soll
// (bsp. $exclude = array("0", "6", "11"); die Foren mit den ID`s 6 und 11 werden ausgelassen
			$exclude = array("0", "23", "29");
// User-ID des Bots
			$botuserid = 5;

// Wer will kann es auch für Prefixe abhängig machen
// sieht dann ca. so aus: if($prefixadd == "[Biete]") {

// oder wer es von einer anklickbaren Box anhängig machen
// will nimmt dann: if($thxbotbox) {

// Wenn Boardid nicht excluded, soll bot posten
			if (!in_array($arguments[boardid], $exclude)) {
				$bottime = $time + 2;
				$db_zugriff->query("INSERT INTO bb".$n."_posts (boardparentid,threadparentid,userid,posttime,posttopic,message,posticon,disable_smilies,signature,ip) VALUES ('$boardid','$nr','$botuserid','$bottime','{thxbotsubject}','{thxbotmessage}','{thxbotposticon}','0','1','{thxbotip}')");
				$db_zugriff->query("UPDATE bb".$n."_threads SET thx = '1', replies=replies+1 WHERE threadid = '$nr'");
				$db_zugriff->query("UPDATE bb".$n."_user_table SET userposts=userposts+1 WHERE userid='$botuserid'");
			}
---

wenn man oben will das der Bot postet, wenn ein User eine checkbox mit
"THX-Bot aktiviert" angeklickt hat muss noch das geändert werden:

2) suche:
---
if($ch_signature) $checked[3] = "CHECKED";
---

danach einfügen:
---
	$thxbotbox = "<TR bgcolor=\"{tableb}\" id=\"tableb\"><td valign=top><FONT face=\"$font\" size=2><B>Bedankomat:</B></font></td><td valign=top><FONT face=\"$font\" size=1><INPUT TYPE=\"CHECKBOX\" NAME=\"thxbotbox\" VALUE=\"1\"> Bedankomat?";
---

### print.php ###
1)suche:
---
	if($posts[posticon]) $posticon = "<img src=\"".$posts[posticon]."\">";
	else $posticon = "&nbsp;";
	if($posts[posttopic]) $posttopic = prepare_topic($posts[posttopic]);
	else $posttopic = "";
	$post = editPost($posts[message],$posts[disable_smilies]);
---
ersetzen durch:
---
	if($posts[posticon] == "{thxbotposticon}") {
		$thx_result = $db_zugriff->query("SELECT userid FROM bb".$n."_thanx WHERE threadid='$threadid'");
		while($row = $db_zugriff->fetch_array($thx_result)) {
			if($thxuser) $thxuser .= ", ";
			$row[username] = getusername($row[userid]);
			$thxuser .= "<b><a href=\"members.php?mode=profile&userid=$row[userid]&boardid=$boardid$session\">$row[username]</a></span></b>";
		}
		$thx_result2 = $db_zugriff->query_first("SELECT count(userid) FROM bb".$n."_thanx WHERE threadid='$threadid'");
		if($thx_result2[0] == 0) $thxusercount = "";
		else $thxusercount = $thx_result2[0];
		$posticon = "<img src=\"images/icons/thumb_up.gif\">";
		$posttopic = "Für diesen Beitrag bedanken sich folgende $thxusercount User:";
		if($thxuser) $thxuser = "$thxuser<br><br>";
		if(($posts[authorid] != $user_id) && $user_id)$thxclick = "<a href=\"action.php?action=thx_vote&threadid=$threadid\">Klicke hier, um Dich zu bedanken!</a>";
		$post = "$thxuser"."$thxclick";
	} else {	
		if($posts[posticon]) $posticon = "<img src=\"".$posts[posticon]."\">";
		else $posticon = "&nbsp;";
		if($posts[posttopic]) $posttopic = prepare_topic($posts[posttopic]);
		else $posttopic	= "";
		$post =	editPost($posts[message],$posts[disable_smilies]);
	}
---

### reply.php ###
1)suche:
---
	if($mode=="quote" && !$preview) {
		$message = $db_zugriff->query_first("SELECT threadparentid, userid, message FROM bb".$n."_posts WHERE postid='$postid'");
		if($message[threadparentid]==$threadid) {
			if($message[userid]) $username = getUsername($message[userid]);
			else eval ("\$username = \"".gettemplate("lg_anonymous")."\";");
			$quote = prepare_quote($message[message]);
			eval ("\$message = \"".gettemplate("reply_quote")."\";");
		}
	}
---
ersetzen durch:
---
	if($mode=="quote" && !$preview) {
		$message = $db_zugriff->query_first("SELECT threadparentid, posticon, userid, message FROM bb".$n."_posts WHERE postid='$postid'");
		if($message[threadparentid]==$threadid) {
			if($message[userid]) $username = getUsername($message[userid]);
			else eval ("\$username = \"".gettemplate("lg_anonymous")."\";");
			if($message[posticon] == "{thxbotposticon}") {
				$thx_result = $db_zugriff->query("SELECT userid FROM bb".$n."_thanx WHERE threadid='$threadid'");
				while($row = $db_zugriff->fetch_array($thx_result)) {
					if($thxuser) $thxuser .= ", ";
					$row[username] = getusername($row[userid]);
					$thxuser .= "$row[username]";
				}
				if($thxuser) $thxuser = "$thxuser\n\n";
				$quote = "$thxuser"."Klicke hier, um Dich zu bedanken!";
			} else {
				$quote = prepare_quote($message[message]);
			}
			eval ("\$message = \"".gettemplate("reply_quote")."\";");
		}
	}
---

2)suche:
---
	if($thread_info[replies]+1 <= $eproseite) {
        	$post_result = $db_zugriff->query("SELECT bb".$n."_posts.*, bb".$n."_user_table.username FROM bb".$n."_posts LEFT JOIN bb".$n."_user_table USING (userid) WHERE threadparentid='$threadid' ORDER by posttime DESC LIMIT 0,".($eproseite));
        	while($posts = $db_zugriff->fetch_array($post_result)) {
        	       	unset($posttopic);
                	if($posts[userid]) $authorname = $posts[username];
                	else eval ("\$authorname = \"".gettemplate("lg_anonymous")."\";");
                	if($posts[posticon]) $posticon = "<img src=\"".$posts[posticon]."\">";
                	else $posticon = "&nbsp;";
                	$posttopic = prepare_topic($posts[posttopic]);
                	$post = editPost($posts[message],$posts[disable_smilies]);
               		$backcolor = rowcolor($j);
                	eval ("\$reply_threadview .= \"".gettemplate("reply_threadview")."\";");
                	$j++;
        	}
	}
---
ersetze durch:
---
	if($thread_info[replies]+1 <= $eproseite) {
		$post_result = $db_zugriff->query("SELECT bb".$n."_posts.*, bb".$n."_user_table.username FROM bb".$n."_posts LEFT JOIN bb".$n."_user_table USING (userid) WHERE threadparentid='$threadid' ORDER by posttime DESC LIMIT 0,".($eproseite));
		while($posts = $db_zugriff->fetch_array($post_result)) {
			unset($posttopic);
			if($posts[userid]) $authorname = $posts[username];
			else eval ("\$authorname = \"".gettemplate("lg_anonymous")."\";");
			if($posts[posticon] == "{thxbotposticon}") {
				$thx_result = $db_zugriff->query("SELECT userid FROM bb".$n."_thanx WHERE threadid='$threadid'");
				while($row = $db_zugriff->fetch_array($thx_result)) {
					if($thxuser) $thxuser .= ", ";
					$row[username] = getusername($row[userid]);
					$thxuser .= "$row[username]";
				}
				$posticon = "<img src=\"images/icons/thumb_up.gif\">";
				$posttopic = "Für diesen Beitrag bedanken sich folgende $thxusercount User:";
				if($thxuser) $thxuser = "$thxuser<br><br>";
				$post = "$thxuser"."$thxclick";
			} else {
				if($posts[posticon]) $posticon = "<img src=\"".$posts[posticon]."\">";
				else $posticon = "&nbsp;";
				$posttopic = prepare_topic($posts[posttopic]);
				$post = editPost($posts[message],$posts[disable_smilies]);
			}
			$backcolor = rowcolor($j);
			eval ("\$reply_threadview .= \"".gettemplate("reply_threadview")."\";");
			$j++;
		}
	} 
---

### search.php ###
1)suche:
---
			if($posts[posticon]) $posticon = "<img src=\"".$posts[posticon]."\">";
			else $posticon = "&nbsp;";
	
			$posttopic = prepare_topic($posts[posttopic]);
			$post = editPost($posts[message],$posts[disable_smilies]);
---
ersetze durch:
---
			if($posts[posticon] == "{thxbotposticon}") {
				$thx_result = $db_zugriff->query("SELECT userid FROM bb".$n."_thanx WHERE threadid='$posts[threadparentid]'");
				while($row = $db_zugriff->fetch_array($thx_result)) {
					if($thxuser) $thxuser .= ", ";
					$row[username] = getusername($row[userid]);
					$thxuser .= "<b><a href=\"members.php?mode=profile&userid=$row[userid]&boardid=$boardid$session\" STYLE=\"TEXT-DECORATION: none;\">$row[username]</a></span></b>";
				}
				$thx_info = $db_zugriff->query_first("SELECT count(userid) FROM bb".$n."_thanx WHERE threadid='$posts[threadparentid]'");
				$thx_info2 = $db_zugriff->query_first("SELECT userid FROM bb".$n."_thanx WHERE threadid = '$posts[threadparentid]' AND userid = '$user_id'");
				if($thx_info[0] == 0) $thxusercount = "";
				else $thxusercount = $thx_info[0];
				$posticon = "<img src=\"images/icons/thumb_up.gif\">";
				$posttopic = "Für diesen Beitrag bedanken sich folgende $thxusercount User:";
				if($thxuser) $thxuser = "$thxuser<br><br>";
				if(($thread_info[authorid] == $user_id) || !$user_id || $thx_info2) $thxclick = "";
				else $thxclick = "<a href=\"action.php?action=thx_vote&threadid=$posts[threadparentid]\" STYLE=\"COLOR: red; TEXT-DECORATION: none;\">Klicke hier, um Dich zu bedanken!</a>";
				$post = "$thxuser"."$thxclick";
			} else {
				 if($posts[posticon]) $posticon = "<img src=\"".$posts[posticon]."\">";
				 else $posticon = "&nbsp;";
				 
				 $posttopic = prepare_topic($posts[posttopic]);
				 $post = editPost($posts[message],$posts[disable_smilies]);
			}
---

### thread.php ###
1)suche:
---
	if($posts[posticon]) $posticon = "<img src=\"$posts[posticon]\">";
	else $posticon = "&nbsp;";
	
	$posttopic = prepare_topic($posts[posttopic]);
	$post = editPost($posts[message],$posts[disable_smilies]);
---
ersetze durch:
---
//Thx-Bot	
	if($posts[posticon] == "{thxbotposticon}") {
		$thx_result = $db_zugriff->query("SELECT userid FROM bb".$n."_thanx WHERE threadid='$threadid'");
		while($row = $db_zugriff->fetch_array($thx_result)) {
			if($thxuser) $thxuser .= ", ";
			$row[username] = getusername($row[userid]);
			$thxuser .= "<b><a href=\"members.php?mode=profile&userid=$row[userid]&boardid=$boardid$session\">$row[username]</a></span></b>";
		}
		$thx_info = $db_zugriff->query_first("SELECT count(userid) FROM bb".$n."_thanx WHERE threadid='$threadid'");
		$thx_info2 = $db_zugriff->query_first("SELECT userid FROM bb".$n."_thanx WHERE threadid = '$threadid' AND userid = '$user_id'");
		if($thx_info[0] == 0) $thxusercount = "";
		else $thxusercount = $thx_info[0];
		$posticon = "<img src=\"images/icons/thumb_up.gif\">";
		$posttopic = "Für diesen Beitrag bedanken sich folgende $thxusercount User:";
		if($thxuser) $thxuser = "$thxuser<br><br>";
		if(($thread_info[authorid] == $user_id) || !$user_id || $thx_info2) $thxclick = "";
		else $thxclick = "<a href=\"action.php?action=thx_vote&threadid=$threadid\">Klicke hier, um Dich zu bedanken!</a>";
		$post = "$thxuser"."$thxclick";
	} else {
		if($posts[posticon]) $posticon = "<img src=\"$posts[posticon]\">";
		else $posticon = "&nbsp;";

		$posttopic = prepare_topic($posts[posttopic]);
		$post = editPost($posts[message],$posts[disable_smilies],$boardid,$threadid,$user_id);
	}
---

2)suche:
---
if($thread_info[flags]!=1) eval ("\$quote_and_edit = \"".gettemplate("thread_quote_edit")."\";");
---
danach einfügen:
---
if($posts[posticon] == "{thxbotposticon}") $quote_and_edit = "";
---

### action.php ###
1)suche:
---
eval ("\$headinclude = \"".gettemplate("headinclude")."\";");
if($ride) eval("dooutput(\"".gettemplate("action_ride")."\");");
else eval("dooutput(\"".gettemplate("action_error")."\");");
?>
---
davor einfügen:
---
// ############## Bedanken - thx ###############
if($action=="thx_vote") {
        if(!$threadid) {
        	header("LOCATION: ".urldecode($url_jump)."");
        	exit;
        }
        if(!$user_id) {
        	header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
        	exit;       
        }
        $thread_info = $db_zugriff->query_first("SELECT authorid, thx FROM bb".$n."_threads WHERE threadid = '$threadid'");
        $thx_info = $db_zugriff->query_first("SELECT userid FROM bb".$n."_thanx WHERE threadid = '$threadid' AND userid = '$user_id'");
	if(!$thread_info[thx] || $thx_info[0] || ($thread_info[authorid] == $user_id)) {
		if(!$thread_info[thx]) $output = "Du kannst dich hierfür nicht bedanken ";
		if($thx_info[0]) $output .= "Du hast dich schon bedankt ";
		if($thread_info[authorid] == $user_id) $output .= "Du kannst dich nicht bei dir selbst bedanken";
        }
        else {
        	if($user_id) $db_zugriff->query("INSERT INTO bb".$n."_thanx VALUES ('$threadid','$user_id')");
        	$ride = urldecode($url_jump);
        	$output = ":)";
        }
}
---

### board.php ###
1) suche:
---
if(($threads[replies]+1)/$eproseite > 1)
---

davor einfügen:
---
	if($threads[thx]){
		$thx_info = $db_zugriff->query_first("SELECT count(userid) FROM bb".$n."_thanx WHERE threadid='$threads[threadid]'");
		$thread_beschreibung .= "<br><font size=1 color=#ee9400> ($thx_info[0] x Danke!) </font>";
	}
---

2) suche: 
---
unset($anonymous_lp); 
---

danach einfügen: 
---
unset($thread_beschreibung);
---


### templates\board_threadbit.htm
1) suche:
---
$thread_link
---

danach einfügen (wenn nicht schon vorhanden):
---
 $thread_beschreibung
---

### templates\mod_threadedit.htm
1) suche:
---
		</table>
	</div>
	<br><div align="center">
		$session_post
		<INPUT TYPE="HIDDEN" NAME="threadid" VALUE="$threadid">
		<INPUT TYPE="HIDDEN" NAME="boardid" VALUE="$boardid">
		<INPUT TYPE="HIDDEN" NAME="action" VALUE="$action">
		<INPUT TYPE="HIDDEN" NAME="send" VALUE="send">
		<INPUT class="input" TYPE="SUBMIT" NAME="submit" ACCESSKEY="S" VALUE="&Auml;nderungen speichern">
		<INPUT class="input" TYPE="RESET" VALUE="&Auml;nderungen l&ouml;schen">
	</div></form>
---

davor einfügen:
---
			<TR bgcolor="{tablec}" id="tablec">
				<td><FONT face="{font}" size=2><B>Zusatz:</B></font></td>
				<td><FONT face="{font}" size=2><INPUT TYPE="CHECKBOX" NAME="thxbot" VALUE="1" $thxbotselected> Bedankomat?</font>
				</td>
			</tr>
---

### mod.php ###
1) suche:
---
if($action == "threadedit") {
	if($userdata[issupermod] || ($userdata[ismod] && check_boardobject($boardid,$user_id,"mod"))) {
		if($send == "send" && $subject = trim($subject)) {
---

danach einfügen:
---
// User-ID des Bots
			$botuserid = 5;

			$thread_info = $db_zugriff->query_first("SELECT * FROM bb".$n."_threads WHERE threadid = '$threadid'");
			if(!$thread_info[thx] && $thxbot){
				$bottime = $thread_info[starttime] + 2;
				$db_zugriff->query("INSERT INTO bb".$n."_posts (boardparentid,threadparentid,userid,posttime,posttopic,message,posticon,disable_smilies,signature,ip) VALUES ('$boardid','$threadid','$botuserid','$bottime','{thxbotsubject}','{thxbotmessage}','{thxbotposticon}','0','1','{thxbotip}')");
				$db_zugriff->query("UPDATE bb".$n."_threads SET thx = '1', replies=replies+1 WHERE threadid = '$threadid'");
				$db_zugriff->query("UPDATE bb".$n."_user_table SET userposts=userposts+1 WHERE userid='$botuserid'");
			}
			if($thread_info[thx] && !$thxbot){
				$db_zugriff->query("DELETE FROM bb".$n."_posts WHERE threadparentid='$threadid' AND userid = '$botuserid'");
				$db_zugriff->query("UPDATE bb".$n."_threads SET thx = '0', replies=replies-1 WHERE threadid = '$threadid'");
				$db_zugriff->query("UPDATE bb".$n."_user_table SET userposts=userposts-1 WHERE userid='$botuserid'");
				$db_zugriff->query("DELETE FROM bb".$n."_thanx WHERE threadid='$threadid'");
			}
---

2) suche:
---
if(!$thread_info[topicicon]) $noicon[0] = "CHECKED"; 
---

danach einfügen:
---
		if($thread_info[thx]) $thxbotselected = " CHECKED";
---

### templates\newthread.htm ###
1) suche:
---
<BR><INPUT TYPE="CHECKBOX" NAME="signature" VALUE="1" $checked[3]> <B>Signatur anzeigen:</B> Soll die im Profil eingestellte Signatur an den Beitrag angehangen werden?
---

danach einfügen:
---
$thxbotbox
---

Die geänderten Dateien und die install-thx.php hochladen.
Die install-thx.php danach ausführen.

done ;)
Wäre echt klasse wenn es klappen würde.

Gruß
Dirk

Verfasst: 07.10.2002 18:16
von Schumi
[edit]veraltetes und sinnloses Posst entfernt[/edit]

Verfasst: 08.10.2002 18:10
von Gast
Ja aber wie macht man das mit phpbb 2.3?

Verfasst: 08.10.2002 18:13
von saerdnaer
phpbb 2.3 gibts noch nicht... da kannste lange warten ;-) wohl eher für die 2.0.3

ah

Verfasst: 08.10.2002 20:11
von Schumi
[edit]veraltetes und sinnloses Post entfernt[/edit]

Verfasst: 12.10.2002 11:31
von saerdnaer
ja schon klar ;-)

Verfasst: 12.10.2002 12:07
von Gast
Ist das nicht für WBB-Board ? Gruss ImI

Verfasst: 23.10.2002 00:40
von YAV
glaub ich auch -
zumindest hab ich so'n bedanker bei einem wbb gesehen .

übersetzt den den einer auf phpbb? :D

Verfasst: 23.10.2002 17:54
von t0xx!n
jaaaaaa

daran wäre ich auch sehr sehr interessiert :)

Verfasst: 04.12.2002 14:47
von AlexDSL
Hat jemand diesen Hack übersetzen können?