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:
|
#!/usr/bin/php<br />
<?PHP
//include
require("global.php");
// BoardID wo das RSS gepostet werden soll
$boardid = 113;
// UserID des "Posters"
$uid = 770;
// Falls $uid != 0 dann Username des "Posters"
$uname = "Fritz";
// Hier kommt dann die RSS URL rein.
$sites[] = "http://rss.golem.de/rss.php?tp=inet&feed=RSS2.0";
print '*** ['.date("d.m.Y H:i").'] Starting script...';
print "\n";
print '*** ['.date("d.m.Y H:i").'] UID->'.$uid.'';
print "\n";
print '*** ['.date("d.m.Y H:i").'] UNAME->'.$uname.'';
print "\n";
print '*** ['.date("d.m.Y H:i").'] BOARDID->'.$boardid.'';
print "\n";
print '*** ['.date("d.m.Y H:i").'] SITESCONT->'.count(sites).'';
print "\n";
$time = time();
for($s = 0;$s < count($sites); $s++){
preg_match("/^((https?|ftp):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",$sites[$s],$input[1]);
$urlsplit = split("/",$input[1][3]);
print '*** ['.date("d.m.Y H:i").'] sites['.$s.'] = '.$urlsplit[0].'';
print "\n";
$content = implode("",file($sites[$s]));
preg_match_all("/\<item\>(.*?)\<\/item\>/si", $content, $results);
for($i = 0;$i < count($results[1]);$i++) {
preg_match("/\<link\>(.*?)\<\/link\>/si", $results[1][$i], $link);
preg_match("/\<title\>(.*?)\<\/title\>/si", $results[1][$i], $title);
preg_match("/\<description\>(.*?)\<\/description\>/si", $results[1][$i], $desc);
preg_match("/\<pubDate\>(.*?)\<\/pubDate\>/si", $results[1][$i], $date);
$link = $link[1];
$title = $title[1];
$desc = $desc[1];
$date = $date[1];
$check = $db->query("SELECT id,title FROM bb".$n."_rss WHERE title = '".addslashes($title)."'");
if($db->num_rows($check) == 0){
$db->query("INSERT INTO `bb".$n."_rss` ( `id` , `from` , `title` , `link` , `description` ) VALUES ('', '".$s."', '".addslashes($title)."', '".addslashes($link)."', '".addslashes($desc)."')");
if(!empty($date)) $news[$s][$i]['date'] = substr($date,0,strlen($date)-6);
$news[$s][$i]['link'] = $link;
$news[$s][$i]['title'] = $title;
$news[$s][$i]['desc'] = $desc;
if(!$news[$s]['name']) $news[$s]['name'] = $urlsplit[0];
print '*** ['.date("d.m.Y H:i").'] DB->INERSRT('.$title.')';
print "\n";
} else {
print '*** ['.date("d.m.Y H:i").'] DB->EXISTS('.$title.')';
print "\n";
}
}
}
for($i = 0;$i < count($news);$i++){
$newstopic[$i] = "".$news[$i]['name']." - News [".date("d.m.Y H:i")."]";
for($a = 0;$a < count($news[$i]);$a++){
if(!empty($news[$i][$a]['date'])) $newstext[$i] .= "[i][".$news[$i][$a]['date']."][/i] [b]» [URL=".$news[$i][$a]['link']."]".$news[$i][$a]['title']."[/URL][/b]\n";
else if(!empty($news[$i][$a]['title'])) $newstext[$i] .= "[b]» [URL=".$news[$i][$a]['link']."]".$news[$i][$a]['title']."[/URL][/b]\n";
if(!empty($news[$i][$a]['desc'])) $newstext[$i] .= "[i]".$news[$i][$a]['desc']."[/i]\n\n";
}
$newstext[$i] .= "\n[i]Quelle: [URL=http://".$news[$i]['name']."]".$news[$i]['name']."[/URL][/i]\n\n";
$newstext[$i] .= "[b]Dieser Beitrag wurde automatisch erstellt.[/b]";
}
for($i = 0;$i < count($newstext);$i++){
$db->query("INSERT INTO bb".$n."_threads (threadid,boardid,topic,iconid,starttime,starterid,starter,lastposttime,lastposterid,lastposter,pollid,important,visible,prefix,thx) VALUES (NULL,'".$boardid."','".addslashes($newstopic[$i])."','3','".$time."','".$uid."','".addslashes($uname)."','".$time."','".$uid."','".addslashes($uname)."','0','0','1','0','1')");
$threadid = $db->insert_id();
print '*** ['.date("d.m.Y H:i").'] DB->CREATE_THRED('.$threadid.'->'.$newstopic[$i].')';
print "\n";
$db->unbuffered_query("UPDATE bb".$n."_stats SET threadcount=threadcount+1", 1);
print '*** ['.date("d.m.Y H:i").'] DB->UPDATE_GLOBAL_THREADCOUNT';
print "\n";
$db->query("INSERT INTO bb".$n."_posts (postid,threadid,userid,username,iconid,posttopic,posttime,message,allowsmilies,showsignature,ipaddress,visible) VALUES "."(NULL,'".$threadid."','".$uid."','".addslashes($uname)."','3','".addslashes($newstopic[$i])."','".$time."','".addslashes($newstext[$i])."','0','0','127.0.0.1','1')");
$postid = $db->insert_id();
print '*** ['.date("d.m.Y H:i").'] DB->CREATE_POST('.$threadid.'->'.$postid.')';
print "\n";
$db->unbuffered_query("UPDATE bb".$n."_stats SET postcount=postcount+1", 1);
print '*** ['.date("d.m.Y H:i").'] DB->UPDATE_GLOBAL_POSTCOUNT';
print "\n";
$db->unbuffered_query("UPDATE bb".$n."_boards SET threadcount=threadcount+1, postcount=postcount+1, lastthreadid='".$threadid."', lastposttime='".$time."', lastposterid='".$uid."', lastposter='".addslashes($uname)."' WHERE boardid IN (".$boardid.")", 1);
print '*** ['.date("d.m.Y H:i").'] DB->UPDATE_BOARD('.$boardid.')';
print "\n";
}
?>
|