User:SoxBot II/Source/Alternative Music

The following post was automatically generated by SoxBot II.

&lt;?PHP

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

include '../svnbots/wikibot.classes.php';

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

if( $argv[2] != &quot;--nosource&quot; ) { $wpi-&gt;forcepost(		'User:'.$user.'/Source/Alternative Music',		'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)'	); } die;

//$month = &quot;March&quot;; //$links = &quot;User:X!/WPAM&quot;; $temp = &quot;Wikipedia:WikiProject Alternative music/Newsletter/$month 2009&quot;; $summary = &quot;Delivering newsletter. (BOT EDIT)&quot;;

$members = $wpq-&gt;getpage(&quot;Wikipedia:WikiProject Alternative music/Members&quot;); preg_match_all('/\{\{user\|(.*?)\}\}/i', $members, $mems); $mems = $mems[1];

$nolink = $wpq-&gt;getpage(&quot;Wikipedia:WikiProject Alternative music/Newsletter&quot;); preg_match_all('/\&lt;!-- (no|only)link: (.*?) --\&gt;/', $nolink, $nol); $nol = $nol[2];

$f = array; foreach( $mems as $fin ) { $fin = str_replace( &quot;_&quot;, &quot; &quot;, $fin ); $fin = ucfirst($fin); $f[] = $fin; }

foreach( $f as $val =&gt; $fi ) { if( in_array( $fi, $nol ) ) { unset( $f[$val] ); } } print_r($f);

preg_match_all('/\&lt;!-- onlylink: (.*?) --\&gt;/', $nolink, $ol); $ol = $ol[1]; foreach ($f as $data) { echo &quot;Posting notice to &quot;.$data.&quot;\n&quot;; $talk = $wpq-&gt;getpage(&quot;User talk:&quot;.$data); $write = $talk.&quot;\n== WikiProject Alternative Music Newsletter for $month 2009 ==\n\n~&quot;;

$wpi-&gt;post(&quot;User talk:&quot;.$data, $write, $summary, false, null, false); }

foreach ($ol as $data) { echo &quot;Posting link to &quot;.$data.&quot;\n&quot;; $talk = $wpq-&gt;getpage(&quot;User talk:&quot;.$data); $write = $talk.&quot;\n== WikiProject Alternative Music Newsletter for $month 2009 ==\n The WikiProject Alternative Music Newsletter for $month 2009 has been released, you can view it here.\n~&quot;;

$wpi-&gt;post(&quot;User talk:&quot;.$data, $write, $summary, false, null, false); }

?&gt;