 |
|
|
|

| Autor |
Nachricht |
sKippah
phpBB2.de User

Anmeldungsdatum: 06.11.2006
Beiträge: 1
|
Verfasst am:
Sa 11 Nov, 2006 05:02 |
  |
Hallo. Ich habe hier einen Bot der neue Threads ins IRC postet. Allerdings ist das gute Stück fürs wbb. Nun wollt ich den gerne fürs phpbb2 umgecodet haben. Leider reichen meine Kenntnisse icht aus. Ein Freund hat mir erklärt ds nicht vile zu ändern sein. Ich poste beide Script (abfrage.php und TCL Script mal hier rein. Evlt kann mir ja jemand helfen. Danke
TCL Script - Das was in einen Eggdrop eingebunden wird um Antworten oder neu eröffnete Threads in den angegeben Channel zu posten.
| Code: |
# '''> script beginn
namespace eval ::forum {
# ''> setting variables
# '> don't change the copyright
variable version "1.0"
variable author "Patrick Günther (Wanne)"
# '> triggers
variable trigger "?forum"
# '<
# '> link
variable link "http://mydomain.myhoster.de/forum//last.php" [b] ist der name der unteren php Datei[/b]
variable posts "http://mydomain.myhoster.deforum/thread.php?postid=:id#post:id"
variable forum "http://mydomain.myhoster.deindex.php"
# '<
# '> database
variable database "forum.db"
# '<
# '>
variable phpcodes {
\xa0 ¡ \xa1 ¢ \xa2 £ \xa3 ¤ \xa4
¥ \xa5 ¦ \xa6 § \xa7 ¨ \xa8 © \xa9
ª \xaa « \xab ¬ \xac ­ \xad ® \xae
¯ \xaf ° \xb0 ± \xb1 ² \xb2 ³ \xb3
´ \xb4 µ \xb5 ¶ \xb6 · \xb7 ¸ \xb8
¹ \xb9 º \xba » \xbb ¼ \xbc ½ \xbd
¾ \xbe ¿ \xbf À \xc0 Á \xc1 Â \xc2
à \xc3 Ä \xc4 Å \xc5 Æ \xc6 Ç \xc7
È \xc8 É \xc9 Ê \xca Ë \xcb Ì \xcc
Í \xcd Î \xce Ï \xcf Ð \xd0 Ñ \xd1
Ò \xd2 Ó \xd3 Ô \xd4 Õ \xd5 Ö \xd6
× \xd7 Ø \xd8 Ù \xd9 Ú \xda Û \xdb
Ü \xdc Ý \xdd Þ \xde ß \xdf à \xe0
á \xe1 â \xe2 ã \xe3 ä \xe4 å \xe5
æ \xe6 ç \xe7 è \xe8 é \xe9 ê \xea
ë \xeb ì \xec í \xed î \xee ï \xef
ð \xf0 ñ \xf1 ò \xf2 ó \xf3 ô \xf4
õ \xf5 ö \xf6 ÷ \xf7 ø \xf8 ù \xf9
ú \xfa û \xfb ü \xfc ý \xfd þ \xfe
ÿ \xff ƒ \u192 Α \u391 Β \u392 Γ \u393
Δ \u394 Ε \u395 Ζ \u396 Η \u397 Θ \u398
Ι \u399 Κ \u39A Λ \u39B Μ \u39C Ν \u39D
Ξ \u39E Ο \u39F Π \u3A0 Ρ \u3A1 Σ \u3A3
Τ \u3A4 Υ \u3A5 Φ \u3A6 Χ \u3A7 Ψ \u3A8
Ω \u3A9 α \u3B1 β \u3B2 γ \u3B3 δ \u3B4
ε \u3B5 ζ \u3B6 η \u3B7 θ \u3B8 ι \u3B9
κ \u3BA λ \u3BB μ \u3BC ν \u3BD ξ \u3BE
ο \u3BF π \u3C0 ρ \u3C1 ς \u3C2 σ \u3C3
τ \u3C4 υ \u3C5 φ \u3C6 χ \u3C7 ψ \u3C8
ω \u3C9 ϑ \u3D1 ϒ \u3D2 ϖ \u3D6
• \u2022 … \u2026 ′ \u2032 ″ \u2033
‾ \u203E ⁄ \u2044 ℘ \u2118 ℑ \u2111
ℜ \u211C ™ \u2122 ℵ \u2135 ← \u2190
↑ \u2191 → \u2192 ↓ \u2193 ↔ \u2194 ↵ \u21B5
⇐ \u21D0 ⇑ \u21D1 ⇒ \u21D2 ⇓ \u21D3 ⇔ \u21D4
∀ \u2200 ∂ \u2202 ∃ \u2203 ∅ \u2205
∇ \u2207 ∈ \u2208 ∉ \u2209 ∋ \u220B ∏ \u220F
∑ \u2211 − \u2212 ∗ \u2217 √ \u221A
∝ \u221D ∞ \u221E ∠ \u2220 &and ;\u2227 ∨ \u2228
∩ \u2229 ∪ \u222A ∫ \u222B ∴ \u2234 ∼ \u223C
≅ \u2245 ≈ \u2248 ≠ \u2260 ≡ \u2261 ≤ \u2264
≥ \u2265 ⊂ \u2282 ⊃ \u2283 ⊄ \u2284 ⊆ \u2286
⊇ \u2287 ⊕ \u2295 ⊗ \u2297 ⊥ \u22A5
⋅ \u22C5 ⌈ \u2308 ⌉ \u2309 ⌊ \u230A
⌋ \u230B ⟨ \u2329 ⟩ \u232A ◊ \u25CA
♠ \u2660 ♣ \u2663 ♥ \u2665 ♦ \u2666
" \x22 & \x26 < \x3C > \x3E Œ \u152
œ \u153 Š \u160 š \u161 Ÿ \u178
ˆ \u2C6 ˜ \u2DC   \u2002   \u2003   \u2009
‌ \u200C ‍ \u200D ‎ \u200E ‏ \u200F – \u2013
— \u2014 ‘ \u2018 ’ \u2019 ‚ \u201A
“ \u201C ” \u201D „ \u201E † \u2020
‡ \u2021 ‰ \u2030 ‹ \u2039 › \u203A
€ \u20AC
ä \xe4 ü \xfc ö \xf6 … .. & \x26
}
# '<
# ''<
# ''> set user defined channel ..
# '> flags
setudef flag forum
# '<
# '> integer
setudef int forum_id
# '<
# ''<
# ''> required packages
# '> http
package require http
# '<
# ''<
# ''> bindings
# '> public messages
bind PUB -|- $trigger ::forum::public
# '<
# '> checking timers
bind TIME -|- * ::forum::timer:check
# '<
# ''<
# ''> checking files
if {![file exists $database]} {
set file [open $database w]
puts -nonewline $file ""
close $file
}
# ''<
# ''> procedures
# '> public messages
proc public { nickname hostname handle channel arguments } {
if {![matchattr $handle n|n $channel]} {
if {[info exists ::forum::last($channel)] && [expr [unixtime] - $::forum::last($channel)] < 30} {
return
}
}
switch -exact -- [string tolower [lindex [split $arguments] 0]] {
an - on - enable {
if {![matchattr $handle n|n $channel]} {
return
} elseif {[channel get $channel forum]} {
putquick "NOTICE $nickname :Forum script is already enabled \{$channel\}."
} else {
channel set $channel +forum; channel set $channel forum_id $::forum::id
putquick "NOTICE $nickname :Forum script enabled successfully \{$channel\}."
}
}
aus - off - disable {
if {![matchattr $handle n|n $channel]} {
return
} elseif {![channel get $channel forum]} {
putquick "NOTICE $nickname :Forum script is already disabled \{$channel\}."
} else {
channel set $channel -forum; channel set $channel forum_id 0
putquick "NOTICE $nickname :Forum script disabled successfully \{$channel\}."
}
}
last {
if {[channel get $channel forum]} {
if {![isnumber [set last [lindex [split $arguments] 1]]]} {
set last 1
} elseif {$last > 5} {
set last 5
}
if {![llength [channel get $channel forum_id]] || [channel get $channel forum_id] < 1} {
channel set $channel forum_id $::forum::id
}
set getid [expr [channel get $channel forum_id] -$last]
while {$getid < $::forum::id} {
incr getid 1
if {[info exists ::forum(write,$getid)]} {
regsub -all -- {:id} $::forum::posts $getid posts
if {$::forum(new,$::forum(thread,$getid)) != "$getid"} {
putquick "PRIVMSG $channel :\[Forum\] \037#$getid\037\002:\002 \[[strftime "%D - %T" $::forum(write,$getid)]\] \037$::forum(from,$getid)\037 answered on \037$::forum(forum,$getid)\037 (Thread: $::forum(thread,$getid)) - \037$posts\037"
} else {
putquick "PRIVMSG $channel :\[Forum\] \037#$getid\037\002:\002 \[[strftime "%D - %T" $::forum(write,$getid)]\] \037$::forum(from,$getid)\037 has open a new Thread ($::forum(thread,$getid)) on \037$::forum(forum,$getid)\037 - \037$posts\037"
}
}
}
}
}
search - suche {
if {![channel get $channel forum]} {
return
} elseif {[llength [split $arguments]] < 2} {
putquick "NOTICE $nickname :Wrong # args: should be \"$::lastbind search <searched words>\" \[wildcards allowed\]."
} else {
set posts 0
foreach {id from} [array get ::forum from,*] {
if {[string match -nocase [lrange [split $arguments] 1 end] $::forum($id)]} {
incr posts 1; set last [lindex [split $id ,] 1]
}
}
putquick "PRIVMSG $channel :found $posts Posts from a nickname matches [lrange [split $arguments] 1 end][expr {$posts ? " (last: \037#$last\037\002:\002 \[[strftime "%D - %T" $::forum(write,$last)]\] from \037$::forum(from,$last)\037 ($::forum(thread,$last)) on \037$::forum(forum,$last)\037 - \037[string map ":id $last" $::forum::posts]\037)" : ""}]."
set posts 0
foreach {id forum} [array get ::forum forum,*] {
if {[string match -nocase [lrange [split $arguments] 1 end] $::forum($id)]} {
incr posts 1; set last [lindex [split $id ,] 1]
}
}
putquick "PRIVMSG $channel :found $posts Posts in Forums matches [lrange [split $arguments] 1 end][expr {$posts ? " (last: \037#$last\037\002:\002 \[[strftime "%D - %T" $::forum(write,$last)]\] from \037$::forum(from,$last)\037 ($::forum(thread,$last)) on \037$::forum(forum,$last)\037 - \037[string map ":id $last" $::forum::posts]\037)" : ""}]."
set posts 0
foreach {id thread} [array get ::forum thread,*] {
if {[string match -nocase [lrange [split $arguments] 1 end] $::forum($id)]} {
incr posts 1; set last [lindex [split $id ,] 1]
}
}
putquick "PRIVMSG $channel :found $posts Posts in Threads matches [lrange [split $arguments] 1 end][expr {$posts ? " (last: \037#$last\037\002:\002 \[[strftime "%D - %T" $::forum(write,$last)]\] from \037$::forum(from,$last)\037 ($::forum(thread,$last)) on \037$::forum(forum,$last)\037 - \037[string map ":id $last" $::forum::posts]\037)" : ""}]."
}
}
get - id - getid {
if {![channel get $channel forum]} {
return
} elseif {[llength [split $arguments]] < 2} {
putquick "NOTICE $nickname :Wrong # args: should be \"$::lastbind get <#ID>\"."
} elseif {[string index [lindex [split $arguments] 1] 0] != "#"} {
putquick "NOTICE $nickname :The #ID must begin with a '#' (e.g.: $::lastbind get #[expr [rand 5000] + 1])."
} elseif {![isnumber [string range [lindex [split $arguments] 1] 1 end]]} {
putquick "NOTICE $nickname :The #ID must be a number. (e.g.: $::lastbind get #[expr [rand 5000] + 1])."
} elseif {![info exists ::forum(write,[set getid [string range [lindex [split $arguments] 1] 1 end]])]} {
putquick "PRIVMSG $channel :ID [lindex [split $arguments] 1] not found."
} else {
regsub -all -- {:id} $::forum::posts $getid posts
if {$::forum(new,$::forum(thread,$getid)) != "$getid"} {
putquick "PRIVMSG $channel :\[Forum\] \037#$getid\037\002:\002 \[[strftime "%D - %T" $::forum(write,$getid)]\] \037$::forum(from,$getid)\037 answered on \037$::forum(forum,$getid)\037 (Thread: $::forum(thread,$getid)) - \037$posts\037"
} else {
putquick "PRIVMSG $channel :\[Forum\] \037#$getid\037\002:\002 \[[strftime "%D - %T" $::forum(write,$getid)]\] \037$::forum(from,$getid)\037 has open a new Thread ($::forum(thread,$getid)) on \037$::forum(forum,$getid)\037 - \037$posts\037"
}
}
}
stat - stats - statistik {
if {[channel get $channel forum]} {
if {[llength [split $arguments]] > 1} {
set total 0; set day 0; set hour 0; set nick [lindex [split $arguments] 1]
if {[info exists ::forum::day]} {
foreach user $::forum::day {
if {[string match -nocase $nick $user]} {
incr day 1; set nick $user
}
}
}
if {[info exists ::forum::hour]} {
foreach user $::forum::hour {
if {[string match -nocase $nick $user]} {
incr hour 1; set nick $user
}
}
}
foreach {var user} [array get ::forum from,*] {
if {[string match -nocase $nick $user]} {
incr total 1; set nick $user
}
}
putquick "PRIVMSG $channel :\[Forum\] Stats for $nick: He has written total $total Posts, $day ([expr {!$total ? "0" : "[format %.2f [expr $day / $total. * 100]]"}]%) Posts today and $hour ([expr {!$day ? "0" : "[format %.2f [expr $hour / $day. * 100]]"}]%) in the current hour."
} else {
set day 0; set hour 0
if {[info exists ::forum::day]} {
set day [llength $::forum::day]
}
if {[info exists ::forum::hour]} {
set hour [llength $::forum::hour]
}
putquick "PRIVMSG $channel :\[Forum\] Stats altogether: Total $::forum::id Posts were written, Today $day ([expr {!$::forum::id ? "0" : "[format %.2f [expr $day / $::forum::id. * 100]]"}]%) and $hour ([expr {!$day ? "0" : "[format %.2f [expr $hour / $day. * 100]]"}]%) in the current hour."
}
}
}
v - ver - vers - version - author - copyright {
if {[channel get $channel forum]} {
putquick "PRIVMSG $channel :\[Forum\] forum.tcl v$::forum::version - Copyright (c) 2006 Patrick Günther (Wanne) <0wn3d-all@arcor.de> #Wanne @QuakeNet"
}
}
default {
if {[channel get $channel forum]} {
putquick "PRIVMSG $channel :\[Forum\] You can find our forum on \037$::forum::forum\037 - altogether $::forum::id Posts - Last Post from $::forum(from,$::forum::id) in $::forum(forum,$::forum::id) (Thread: $::forum(thread,$::forum::id))"
putquick "PRIVMSG $channel :\[Forum\] Commands: stats \[nick\], search <word>, last <number>, get <#ID>."
}
if {[matchattr $handle n|n $channel]} {
putquick "NOTICE $nickname :Forum script is currently [expr {[channel get $channel forum] ? "enabled" : "disabled"}] \{$channel\}."
putquick "NOTICE $nickname :To [expr {[channel get $channel forum] ? "disable" : "enable"}] it, type: '$::lastbind [expr {[channel get $channel forum] ? "off" : "on"}]'."
}
}
}
}
# '<
# '> check for new postings
proc check { } {
set connection [http::config -useragent "Mozilla 4.0"]
catch { set connection [http::geturl $::forum::link -timeout 3000] } error
if {![string match -nocase "*couldn't open socket*" $error]} {
set source [http::data $connection]
http::cleanup $connection
foreach entry [split $source \n] {
if {[isnumber [string trim [lindex [split $entry |] 0]]]} {
if {![info exist id]} {
set id [string trim [lindex [split $entry |] 0]]
set ::forum::id $id
}
if {![info exists ::forum(write,[string trim [lindex [split $entry |] 0]])]} {
set ::forum(write,[string trim [lindex [split $entry |] 0]]) [unixtime]
set ::forum(forum,[string trim [lindex [split $entry |] 0]]) [replace [string trim [lindex [split $entry |] 1]]]
set ::forum(thread,[string trim [lindex [split $entry |] 0]]) [replace [string trim [lindex [split $entry |] 2]]]
set ::forum(from,[string trim [lindex [split $entry |] 0]]) [replace [string trim [lindex [split $entry |] 3]]]
if {![info exists ::forum(new,$::forum(thread,[string trim [lindex [split $entry |] 0]]))]} {
set ::forum(new,$::forum(thread,[string trim [lindex [split $entry |] 0]])) [string trim [lindex [split $entry |] 0]]
}
set file [open $::forum::database a]
puts $file [encrypt database "$entry | [unixtime]"]
close $file
lappend ::forum::hour [replace [string trim [lindex [split $entry |] 3]]]
lappend ::forum::day [replace [string trim [lindex [split $entry |] 3]]]
}
}
}
if {[info exists id]} {
foreach channel [channels] {
if {[channel get $channel forum]} {
if {![llength [channel get $channel forum_id]] || [channel get $channel forum_id] < 1} {
channel set $channel forum_id [expr $id -1]
}
set getid [channel get $channel forum_id]
while {$getid < $id} {
incr getid 1
if {[info exists ::forum(write,$getid)]} {
regsub -all -- {:id} $::forum::posts $getid posts
if {$::forum(new,$::forum(thread,$getid)) != "$getid"} {
putquick "PRIVMSG $channel :\[Forum\] \037#$getid\037\002:\002 \037$::forum(from,$getid)\037 answered on \037$::forum(forum,$getid)\037 (Thread: $::forum(thread,$getid)) - \037$posts\037"
} else {
putquick "PRIVMSG $channel :\[Forum\] \037#$getid\037\002:\002 \037$::forum(from,$getid)\037 has open a new Thread ($::forum(thread,$getid)) on \037$::forum(forum,$getid)\037 - \037$posts\037"
}
}
}
channel set $channel forum_id $id
}
}
}
}
utimer 1 [list ::forum::check]
}
# '<
# '> replace
proc replace { string } {
regsub -all {:evil:} $string {>:|} string
regsub -all {:baby:} $string {:O} string
regsub -all {:rolleyes:} $string {^^} string
return [string map $::forum::phpcodes $string]
}
# '<
# '> timer check
proc timer:check { minute hour day month year } {
if {![string match timer* [utimerexists [list ::forum::check]]]} {
utimer 1 [list ::forum::check]
}
if {!$minute} {
if {[info exists ::forum::hour]} {
unset ::forum::hour
}
if {!$hour && [info exists ::forum::day]} {
unset ::forum::day
}
}
}
# '<
# '> relaod variables
proc reload { } {
set file [open $::forum::database r]
while {![eof $file]} {
if {[set entry [decrypt database [gets $file]]] != ""} {
set ::forum(write,[string trim [lindex [split $entry |] 0]]) [string trim [lindex [split $entry |] 4]]
set ::forum(forum,[string trim [lindex [split $entry |] 0]]) [replace [string trim [lindex [split $entry |] 1]]]
set ::forum(thread,[string trim [lindex [split $entry |] 0]]) [replace [string trim [lindex [split $entry |] 2]]]
set ::forum(from,[string trim [lindex [split $entry |] 0]]) [replace [string trim [lindex [split $entry |] 3]]]
if {![info exists ::forum(new,$::forum(thread,[string trim [lindex [split $entry |] 0]]))]} {
set ::forum(new,$::forum(thread,[string trim [lindex [split $entry |] 0]])) [string trim [lindex [split $entry |] 0]]
}
}
}
close $file
}
reload
# '<
# ''<
# ''> timers
if {![string match timer* [utimerexists [list ::forum::check]]]} {
utimer 1 [list ::forum::check]
}
# ''<
# ''> copyright informations
putlog "forum.tcl v$version loaded successfully - $author"
# ''<
}
|
URLs müssen entsprechen angepasst werden
und hier das php abfrage Script das in den Root ordner des Forums geladen wird
| PHP: |
<?
<?
define('mysql_hostname', 'localhost');
define('mysql_username', '');
define('mysql_password', '');
define('mysql_database', '');
function connect_to_mysql() {
mysql_connect(mysql_hostname, mysql_username, mysql_password) OR
die("<b>ERROR:</b> Kann keine Verbindung zur Datenbank herstellen. Bitte kontaktieren sie einen <a href="mailto:Eure@Mail.de">Administrator</a>!<br /><br />n" ;
mysql_select_db(mysql_database) OR
die("<b>ERROR:</b> Kann keine Verbindung zur Datenbank herstellen. Bitte kontaktieren sie einen <a href="mailto:Eure@Mail.de">Administrator</a>!<br /><br /><br />n" ;
}
connect_to_mysql();
$sql = "SELECT p.postid, t.topic, b.title, p.username
FROM bb1_posts p, bb1_boards b, bb1_threads t
WHERE b.boardid = t.boardid AND
p.threadid = t.threadid
ORDER BY p.postid DESC LIMIT 0, 5; ";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
while($row) {
echo "
".$row['postid']." | ".$row['title']." | ".$row['topic']." | ".$row['username']."
";
echo "<br />";
$row = mysql_fetch_assoc($result);
}
mysql_free_result($result);
?>
|
Wie gesagt. In der Form funktioniert es NICHT fürs phpbb. Hoffe das kann jemand anpassen...
Danke |
|
|
   |
 |
Google
|
Verfasst am:
|
 |
|
|
 |
TerraTux
Support Team Member


Anmeldungsdatum: 02.08.2002
Beiträge: 1026
Wohnort: Delitzsch
|
Verfasst am:
Di 21 Nov, 2006 02:43 |
  |
Kannst Du das evtl. ein Stück näher erläutern?
Was wird im Chan angezeigt, wenn das Dinge losfeuert?
Im Moment fehlt mir noch ein ausgefülltes Feld, weiß nicht ob das ein Stück vom Thementext sein soll...
Ist wirklich sehr rudimentär, keine Prüfung auf Zugriffsrechte nichts...schaffst dann aber sicher noch auszubauen
| PHP: |
<?php
define ('IN_PHPBB', TRUE);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require ($phpbb_root_path .'common.'. $phpEx);
$sql = 'SELECT t.*, u.username
FROM '. TOPICS_TABLE .' t, '. USERS_TABLE .' u
WHERE t.topic_poster = u.user_id
ORDER BY t.topic_id DESC LIMIT 0, 5';
$query = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($query))
{
echo '"'. $row['topic_poster'] .'" | "'. $row['topic_title'] .'" | "Irgend n Titel" | "'. $row['username'] .'"<br />';
}
$db->sql_freeresult($query);
?>
|
An dem TCL-Script muss nicht wirklich was geändert werden. Sprech zwar kein TCL, aber so wie es ausschaut, ruft das Teil nur das PHP-Script auf und verarbeitet dessen Ausgabe, welche ja nicht wirklich verändert wurde.
Probier es mal aus, und gib Bescheid.
Gruß,
TT |
_________________ software is like sex, it's better if it's free
Kein Support per PM || EMail || Messenger |
|
     |
 |
DarkloOrd
phpBB2.de User

Anmeldungsdatum: 19.11.2006
Beiträge: 14
|
Verfasst am:
Mo 27 Nov, 2006 18:56 |
  |
Hatt das jetzt mal einer getestet?
Ich würde es gerne mal einbauen habe aber noch keinen eggdrop!
mfg |
|
|
   |
 |
|
|
|
|
|
Nächstes Thema anzeigen
Vorheriges Thema anzeigen
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen. Du kannst Dateien in diesem Forum posten Du kannst Dateien in diesem Forum herunterladen
|
|
| |