User:SoxBot V/Source

The following is automatically generated by SoxBot V.


  • wikibot.classes.php is here.


Source to SoxBot V

<?PHP

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

$wpapi->login($user,$pass);
     
$wpi->forcepost('User:'.$user.'/Source',"The following is automatically generated by [[User:".$user."|]].\n\n\n\n* wikibot.classes.php is [[User:ClueBot/Source|here]].\n\n\n\n==Source to ".$user."==\n\n<pre>".htmlentities(file_get_contents(__FILE__))."</pre>\n\n\n\n~~~",'Automated source upload.'); /* Our source code, we force post this because this is *our* page, and it triggers the nobots. */
                
echo "Updating groups\n";
function numingroup($group) {
	$http = new http;
	$x = $http->get('http://en.wikipedia.org/w/api.php?action=query&list=allusers&augroup='.$group.'&aulimit=500&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'] != "") {
		$zcont['query-continue']['allusers']['aufrom'] = $x['query-continue']['allusers']['aufrom'];
		while ($zcont['query-continue']['allusers']['aufrom'] != "") {
                $nextuser = urlencode($zcont['query-continue']['allusers']['aufrom']);
                $qurl = 'http://en.wikipedia.org/w/api.php?action=query&list=allusers&augroup='.$group.'&aulimit=500&format=php&aufrom=' . $nextuser;
                $aa = $http->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' => $crat, 'checkusers' => $cu, 'oversighters' => $os, 'rollbackers' => $roll, 'accountcreators' => $acc, 'ipblock-exempters' => $ipbe);

$text = $wpq->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 = "{{#switch: {{{1|}}} \n|admin = {{NUMBEROFADMINS}} \n|bureaucrat = ".$numig['crats']." \n|checkuser = ".$numig['checkusers']." \n|oversight = ".$numig['oversighters']." \n|rollbacker = ".$numig['rollbackers']." \n|accountcreator = ".$numig['accountcreators']." \n|ipblock-exempt = ".$numig['ipblock-exempters']." \n|#default = 0 \n}}";

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

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

?>


SoxBot V (talk)

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.