User:SoxBot V/Source

The following is automatically generated by SoxBot V.


 * wikibot.classes.php is here.

Source to SoxBot V
&lt;?PHP

include '../Cluebot2/wikibot.classes.php'; include '../Cluebot2/cluebot5.config.php'; $wpq = new wikipediaquery; $wpapi = new wikipediaapi; $wpi = new wikipediaindex; $http = new http;

$wpapi-&gt;login($user,$pass); $wpi-&gt;forcepost('User:'.$user.'/Source',&quot;The following is automatically generated by User:&quot;.$user.&quot;.\n\n\n\n* wikibot.classes.php is here.\n\n\n\n==Source to &quot;.$user.&quot;==\n\n&lt;pre&gt;&quot;.htmlentities(file_get_contents(__FILE__)).&quot;&lt;/pre&gt;\n\n\n\n&quot;,'Automated source upload.'); /* Our source code, we force post this because this is *our* page, and it triggers the nobots. */ echo &quot;Updating groups\n&quot;; function numingroup($group) { $http = new http; $x = $http-&gt;get('http://en.wikipedia.org/w/api.php?action=query&amp;list=allusers&amp;augroup='.$group.'&amp;aulimit=500&amp;format=php'); $x = unserialize($x); $y = $x['query']['allusers']; $num = array; foreach($y as $user) { array_push($num, $user['name']); }	if ($x['query-continue']['allusers']['aufrom'] != &quot;&quot;) { $zcont['query-continue']['allusers']['aufrom'] = $x['query-continue']['allusers']['aufrom']; while ($zcont['query-continue']['allusers']['aufrom'] != &quot;&quot;) { $nextuser = urlencode($zcont['query-continue']['allusers']['aufrom']); $qurl = 'http://en.wikipedia.org/w/api.php?action=query&amp;list=allusers&amp;augroup='.$group.'&amp;aulimit=500&amp;format=php&amp;aufrom='. $nextuser; $aa = $http-&gt;get($qurl); $zcont = unserialize($aa); $zcont2 = $zcont[query][allusers]; foreach($zcont2 as $user2) { array_push($num, $user2[name]); }       }	}	return count($num); }

$crat = numingroup('bureaucrat'); $cu = numingroup('checkuser'); $os = numingroup('oversight'); $roll = numingroup('rollbacker'); $acc = numingroup('accountcreator'); $ipbe = numingroup('ipblock-exempt'); $numig = array('crats' =&gt; $crat, 'checkusers' =&gt; $cu, 'oversighters' =&gt; $os, 'rollbackers' =&gt; $roll, 'accountcreators' =&gt; $acc, 'ipblock-exempters' =&gt; $ipbe);

$text = $wpq-&gt;getpage('User:Soxred93/numingroup'); $default = '\{\{#switch\: \{\{\{1\|\}\}\} \n\|admin \= \{\{NUMBEROFADMINS\}\} \n\|bureaucrat \= (.*) \n\|checkuser \= (.*) \n\|oversight \= (.*) \n\|rollbacker \= (.*) \n\|accountcreator \= (.*) \n\|ipblock-exempt \= (.*) \n\|#default \= 0 \n\}\}'; preg_match('/'.$default.'/', $text, $m); $new = &quot;&quot;;

$changes = null; if ($numig['crats'] != $m[1]) { $changes .= $m[1].&quot; crats to &quot;.$numig['crats'].&quot;, &quot;; } if ($numig['checkusers'] != $m[2]) { $changes .= $m[2].&quot; checkusers to &quot;.$numig['checkusers'].&quot;, &quot;; } if ($numig['oversighters'] != $m[3]) { $changes .= $m[3].&quot; oversighters to &quot;.$numig['oversighters'].&quot;, &quot;; } if ($numig['rollbackers'] != $m[4]) { $changes .= $m[4].&quot; rollbackers to &quot;.$numig['rollbackers'].&quot;, &quot;; } if ($numig['accountcreators'] != $m[5]) { $changes .= $m[5].&quot; accountcreators to &quot;.$numig['accountcreators'].&quot;, &quot;; } if ($numig['ipblock-exempters'] != $m[6]) { $changes .= $m[6].&quot; ipblock-exempters to &quot;.$numig['ipblock-exempters'].&quot;, &quot;; } $summary = &quot;Changing &quot;.$changes.&quot;a BOT EDIT.&quot;;

$wpi-&gt;post('User:Soxred93/numingroup', $new, $summary);

?&gt;

SoxBot V (talk)