From Wikipedia, the free encyclopedia
<?php
include("SxWiki.php"); //Include framework
$url = 'http://en.wikipedia.org/w/'; //Set for the English Wikipedia
$sxLgTA = sxLogin("user", "pass"); //Log in
$sxLgID = $sxLgTA[uid];
$sxLgT = $sxLgTA[token];
$maxlag = "5"; //Set maxlag to 5
$epm = setEPM(10); //set 10 edits per min.
$articles = sxGetTransclusion("Template:WPGUNS", "all");
$art = array();
$cat = array();
$temp = array();
$img = array();
foreach ($articles as $article) {
preg_match('/^Talk:(.*)/', $article, $talkmatches);
if($talkmatches[1] != "") {array_push($art, $talkmatches[1]);}
preg_match('/^Template talk:(.*)/', $article, $ttm);
if($ttm[1] != "") {$ttm[1] = ":Template:" . $ttm[1]; array_push($temp, $ttm[1]);}
preg_match('/^Category talk:(.*)/', $article, $ctm);
if($ctm[1] != "") {$ctm[1] = ":Category:" . $ctm[1]; array_push($cat, $ctm[1]);}
preg_match('/^Image talk:(.*)/', $article, $itm);
if($itm[1] != "") {$itm[1] = ":Image:" . $itm[1]; array_push($img, $itm[1]);}
}
$output = "To monitor changes to these pages, [[Special:Recentchangeslinked/Wikipedia:WikiProject_Firearms/Watchlist|Click here]]. \r\n==Watchlist==\r\n===Articles===\r\n";
foreach ($art as $s_art) {
$output = $output . "* [[" . $s_art . "]]\r\n";
}
$output = $output . "===Images===\r\n";
foreach ($img as $s_img) {
$output = $output . "* [[" . $s_img . "]]\r\n";
}
$output = $output . "===Categories===\r\n";
foreach ($cat as $s_cat) {
$output = $output . "* [[" . $s_cat . "]]\r\n";
}
$output = $output . "===Templates===\r\n";
foreach ($temp as $s_temp) {
$output = $output . "* [[" . $s_temp . "]]\r\n";
}
sxPutPage("Wikipedia:WikiProject Firearms/Watchlist", "Updating watchlist", $output, $null);
?>