User:Addbot/Source
Appearance
The following is automatically generated by Addbot.
Bot (bot.addbot.php)
[edit]<? //From http://toolserver.org/~chris/highlight.php?d=chris/classes/&f=botclasses.php require 'bot.classes.php'; $wiki = new wikipedia; $wiki->url = 'http://en.wikipedia.org/w/api.php'; global $wiki; $user = "Addbot"; $owner = "Addshore"; require 'bot.password.php'; $wiki->login($user,$pass); echo "USER: Logged In!\n"; unset($pass); ?>
Talksubst Bot
[edit]talksubst/run.php
[edit]<?PHP require '../bot.addbot.php'; //Get the list of templates and strip away the rubbish $awbutt = explode('expand the template(s) on the user talk page.',$wiki->getpage('Wikipedia:AutoWikiBrowser/User_talk_templates')); $awbutt = str_ireplace(']]','',str_ireplace('# [[','',str_ireplace(']]# [[','|',ereg_replace ("\n",'',$awbutt[1])))); //$awbutt = str_ireplace('<noinclude>{{pp-semi-protected|small=yes}}</noinclude>{{AWB}}{{shortcut|WP:AWB/UTT}}This page contains templates that AWB will automatically substitute on user talk pages as part of the AWB general fixes. Please make sure that general fixes are enabled, and this will be done when processing user talk pages. The MediaWiki API is used to automatically substitute and expand the template(s) on the user talk page.).','',$awbutt); $awbutt = explode('|',$awbutt); //check each template foreach ($awbutt as $template) { //Get the pages the template is found on $pages = $wiki->getTransclusions($template); foreach ($pages as $page) { //If it is a user talk page and is not a sub page if ( (strpos($page,"User talk:") !== FALSE) && (strpos($page,"/") === FALSE) ) { //Get the content and try to subst the template $content = $wiki->getpage($page); $content = str_ireplace("{{".$template,"{{subst:".$template,$content); $content = str_ireplace("{{".str_replace("Template:","",$template),"{{subst:".$template,$content); echo "$page\n\r"; $wiki->edit($page,$content,"[[User:Addbot|Bot:]] Substing template $template",true); } } } ?>
Sandbox Bot
[edit]sandbox/run_clean.php
[edit]<?PHP require '../bot.addbot.php'; require 'sandboxes.php'; global $wiki; //Check all of the content sets for ($i = 1; $i <= count($sandbox); $i++) { //And check each page for this content for ($j = 1; $j <= (count($sandbox[$i])-1); $j++) { $page = $sandbox[$i][$j]; $content = $sandbox[$i][0]; if ($wiki->getpage($page) == $content) { $wiki->edit($page,$content,"[[User:Addbot|Bot:]] Restoring $page",true); } } } ?>
sandbox/run_header.php
[edit]<?PHP require '../bot.addbot.php'; require 'sandboxes.php'; global $wiki; //Check all of the content sets for ($i = 1; $i <= count($sandbox); $i++) { //And check each page for this content for ($j = 1; $j <= (count($sandbox[$i])-1); $j++) { $page = $sandbox[$i][$j]; $content = $sandbox[$i][0]; if (strpos($wiki->getpage($page),$content) === FALSE) { $wiki->edit($page,$content,"[[User:Addbot|Bot:]] Restoring $page header",true); } } } ?>
sandbox/sandboxes.php
[edit]<? //Sandboxes $sandbox[1][0] = "{{Please leave this line alone (sandbox heading)}}\n<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->"; $sandbox[1][1] = 'Wikipedia:Sandbox'; $sandbox[2][0] = "{{Please leave this line alone (sandbox talk heading)}}\n<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->"; $sandbox[2][1] = 'Wikipedia_talk:Sandbox'; $sandbox[3][0] = "{{Please leave this line alone (tutorial sandbox heading)}}\n<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->"; $sandbox[3][1] = 'Wikipedia:Tutorial (Editing)/sandbox'; $sandbox[3][2] = 'Wikipedia:Tutorial (Formatting)/sandbox'; $sandbox[3][3] = 'Wikipedia:Tutorial (Wikipedia links)/sandbox'; $sandbox[3][4] = 'Wikipedia:Tutorial (Citing sources)/sandbox'; $sandbox[3][5] = 'Wikipedia:Tutorial (Keep in mind)/sandbox'; $sandbox[4][0] = "{{Please leave this line alone (sandbox talk heading)}}\n<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->"; for($i = 1; $i <= 9; $i++){ $sandbox[4][$i] = "Template_talk:X$i"; } $sandbox[4][10] = 'Wikipedia talk:Tutorial/Editing/sandbox'; $sandbox[4][11] = 'Wikipedia talk:Tutorial/Formatting/sandbox'; $sandbox[4][12] = 'Wikipedia talk:Tutorial/Wikipedia links/sandbox'; $sandbox[4][13] = 'Wikipedia talk:Tutorial/Citing sources/sandbox'; $sandbox[4][14] = 'Wikipedia talk:Tutorial/Keep in mind/sandbox'; $sandbox[5][0] = "<noinclude>\nThis sandbox is itself a template. This sandbox is for experimenting with templates.\n{{Please leave this line alone (template sandbox heading)}}\n</noinclude>\n\nIf you defined parameters such as <tt><nowiki>{{Template sandbox|First|Second|name=\"Named\"}}</nowiki></tt>:\n;First:{{{1}}}\n;Second:{{{2}}}\n;Name:{{{name}}}\n\n----"; $sandbox[5][1] = 'Template:Template sandbox'; $sandbox[6][0] = "<noinclude>\nThis sandbox is itself a template. This sandbox is for experimenting with templates.\n{{Please leave this line alone (template sandbox heading)}}\n</noinclude>\n\nIf you defined parameters such as <tt><nowiki>{{Template sandbox|First|Second|name=\"Named\"}}</nowiki></tt>:\n;First:{{{1}}}\n;Second:{{{2}}}\n;Name:{{{name}}}\n\n----\n<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->"; for($i = 1; $i <= 9; $i++){ $sandbox[6][$i] = "Template:X$i"; } ?>
Sourcecode Bot
[edit]sourcecode/run.php
[edit]<? require '../bot.addbot.php'; $wiki->edit('User:'.$user.'/Source', 'The following is automatically generated by [[User:'.$user.'|'.$user."]].\n\n\n". //"==Classes (bot.classes.php)==\n\n<pre>".htmlentities(file_get_contents('../bot.classes.php'))."</pre>\n\n\n". "==Bot (bot.addbot.php)==\n\n".'<pre>'.htmlentities(file_get_contents('../bot.addbot.php'))."</pre>\n\n\n". "==Talksubst Bot==\n\n". "===talksubst/run.php===\n\n<pre>".htmlentities(file_get_contents('../talksubst/run.php'))."</pre>\n\n\n". "==Sandbox Bot==\n\n". "===sandbox/run_clean.php===\n\n<pre>".htmlentities(file_get_contents('../sandbox/run_clean.php'))."</pre>\n\n\n". "===sandbox/run_header.php===\n\n<pre>".htmlentities(file_get_contents('../sandbox/run_header.php'))."</pre>\n\n\n". "===sandbox/sandboxes.php===\n\n<pre>".htmlentities(file_get_contents('../sandbox/sandboxes.php'))."</pre>\n\n\n". "==Sourcecode Bot==\n\n". "===sourcecode/run.php===\n\n<pre>".htmlentities(file_get_contents('run.php'))."</pre>\n\n\n" ,'[[User:Addbot|BOT:]] Automated source upload'); ?>