User:SoxBot II/Source/Signpost

The following post was automatically generated by SoxBot II.

&lt;?php

while( $vol == &quot;&quot; ) { echo &quot;What volume is this issue in?\n&quot;; $vol = trim(fgets(STDIN)); }

while( $issue == &quot;&quot; ) { echo &quot;What issue is this?\n&quot;; $issue = trim(fgets(STDIN)); }

include(&quot;/home/soxred93/wikibot.classes.php&quot;);

$user = 'SoxBot II'; $pass = file_get_contents('/home/soxred93/.password'); //Setup the classes $wpapi = new wikipediaapi; $wpq   = new wikipediaquery; $wpi   = new wikipediaindex; $wpapi-&gt;login($user,$pass);

if( $argv[2] != &quot;--nosource&quot; ) { $wpi-&gt;forcepost(		'User:'.$user.'/Source/Signpost',		'The following post was automatically generated by '.$user.&quot;.\n\n&lt;pre&gt;&quot; .		htmlentities(file_get_contents(__FILE__)) . 		&quot;&lt;/pre&gt;&quot;,		'Automatic source code upload (BOT)'	); }

$delivery['page'] = 'Wikipedia:Wikipedia_Signpost/Tools/Spamlist'; $delivery['text'] = &quot;\n\n \n\r&lt;small&gt;Delivered by  at &lt;/small&gt;&quot;; $delivery['sum']  = &quot;Delivering Vol. $vol, Issue $issue of Wikipedia Signpost (BOT)&quot;;

preg_match_all('/[^\&gt;]\[\[(User|User_talk|User talk):.+\]\]/Si',$wpq-&gt;getpage($delivery['page']),$pages); foreach ($pages[0] as $i =&gt; $p) { $temp = explode('|',$p); $p = preg_replace(array('/.*\[\[(User|User_talk|User talk):/Si','/\]\].*/i'),'',$temp[0]); deliver($p); }

function deliver($page) { //Delivers the newsletter to $page global $wpi, $wpapi, $wpq, $delivery; $page = &quot;User_talk:&quot;.trim($page); $content = $wpq-&gt;getpage($page); if (preg_match('/#REDIRECT \[\[.+\]\]/Si',$content,$new_page)) { $page = str_replace(array('#REDIRECT ',),,$new_page[0]); if( !preg_match('/\[\[(User|User_talk|User talk):.+\]\]/Si', $page) ) return; }	$content = $wpq-&gt;getpage($page); echo &quot;Sending to $page\n&quot;; if ($content != ''){ $wpi-&gt;post($page,$content.$delivery['text'],$delivery['sum'],$minor = false,$rv = null,$bot = false); } }