Utilisateur:Wikialine/Codes sources
Apparence
Utilisateur:Alinebot
[modifier | modifier le code]<?php
// Inclusion des classes
include 'class/http.class.php';
include 'class/wikiapi.class.php';
// Tu instancies la classe, en précisant le wiki auquel du désires te connecter (ici Wikipédia)
$alinebot = new wikipediaapi('fr.wikipedia.org');
// Ensuite, tu te connectes en précisant ton pseudo et ton mot de passe (ce qui devrait résoudre le bug de l'historique ;) )
$alinebot->login ( 'AlineBot', 'ton mot de passe' ) ;
// Et tu édites ensuite ta page
$page_nom = "User:AlineBot/Test1";
$page_contenu = "Ceci est un test de modification de la page $page_nom par {{u|AlineBot}} !!!\n";
$resume = "Bot : Mise à jour du modèle en ajoutant une donnée...";
$alinebot->edit ($page_nom , $page_contenu , $resume) ;
?>
Utilisateur:CaBot
[modifier | modifier le code]- http.class.php
- wikiapi.class.php
- wikiadmin.class.php
User:Quentinv57/CaBot/Source/class/http.class.php
[modifier | modifier le code]This file has been written by , see .
<?php
// Please define a HTTP_USER_AGENT string (required to connect to MediaWiki)
define ('USER_AGENT', "CaBot Script" );
// by Cobi Carter
class http {
private $ch;
private $uid;
public $postfollowredirs;
public $getfollowredirs;
/**
* Our constructor function. This just does basic cURL initialization.
* @return void
**/
function __construct () {
global $proxyhost, $proxyport;
$this->ch = curl_init();
$this->uid = dechex(rand(0,99999999));
curl_setopt($this->ch,CURLOPT_COOKIEJAR,'/tmp/cluewikibot.cookies.'.$this->uid.'.dat');
curl_setopt($this->ch,CURLOPT_COOKIEFILE,'/tmp/cluewikibot.cookies.'.$this->uid.'.dat');
curl_setopt($this->ch,CURLOPT_MAXCONNECTS,100);
curl_setopt($this->ch,CURLOPT_CLOSEPOLICY,CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
if (isset($proxyhost) and isset($proxyport) and ($proxyport != null) and ($proxyhost != null)) {
curl_setopt($this->ch,CURLOPT_PROXYTYPE,CURLPROXY_HTTP);
curl_setopt($this->ch,CURLOPT_PROXY,$proxyhost);
curl_setopt($this->ch,CURLOPT_PROXYPORT,$proxyport);
}
$this->postfollowredirs = 0;
$this->getfollowredirs = 1;
}
/**
* Post to a URL.
* @param $url The URL to post to.
* @param $data The post-data to post, should be an array of key => value pairs.
* @return Data retrieved from the POST request.
**/
function post ($url,$data) {
$time = microtime(1);
curl_setopt($this->ch,CURLOPT_URL,$url);
curl_setopt($this->ch,CURLOPT_FOLLOWLOCATION,$this->postfollowredirs);
curl_setopt($this->ch,CURLOPT_MAXREDIRS,10);
curl_setopt($this->ch,CURLOPT_HEADER,0);
curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($this->ch,CURLOPT_TIMEOUT,30);
curl_setopt($this->ch,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($this->ch,CURLOPT_POST,1);
curl_setopt($this->ch,CURLOPT_POSTFIELDS, $data);
curl_setopt($this->ch,CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($this->ch, CURLOPT_USERAGENT, USER_AGENT);
$data = curl_exec($this->ch);
global $logfd; if (!is_resource($logfd)) $logfd = fopen('php://stderr','w'); fwrite($logfd,'POST: '.$url.' ('.(microtime(1) - $time).' s) ('.strlen($data)." b)\n");
return $data;
}
/**
* Get a URL.
* @param $url The URL to get.
* @return Data retrieved from the GET request.
**/
function get ($url) {
$time = microtime(1);
curl_setopt($this->ch,CURLOPT_URL,$url);
curl_setopt($this->ch,CURLOPT_FOLLOWLOCATION,$this->getfollowredirs);
curl_setopt($this->ch,CURLOPT_MAXREDIRS,10);
curl_setopt($this->ch,CURLOPT_HEADER,0);
curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($this->ch,CURLOPT_TIMEOUT,30);
curl_setopt($this->ch,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($this->ch,CURLOPT_HTTPGET,1);
$useragent = "CaBot Script (running on nightshade.toolserver.org)";
curl_setopt($this->ch, CURLOPT_USERAGENT, $useragent);
$data = curl_exec($this->ch);
// global $logfd; if (!is_resource($logfd)) $logfd = fopen('php://stderr','w'); fwrite($logfd,'GET: '.$url.' ('.(microtime(1) - $time).' s) ('.strlen($data)." b)\n");
return $data;
}
/**
* Our destructor. Cleans up cURL and unlinks temporary files.
**/
function __destruct () {
curl_close($this->ch);
@unlink('/tmp/cluewikibot.cookies.'.$this->uid.'.dat');
}
}
?>
User:Quentinv57/CaBot/Source/class/wikiapi.class.php
[modifier | modifier le code]This file is based on from .
<?php
/**
* This class is for interacting with Wikipedia's api.php API.
**/
class wikipediaapi {
private $http;
private $edittoken;
private $tokencache;
public $continue = NULL;
public $apiurl;
private $lastedit = NULL;
/**
* This is our constructor.
* @return void
**/
function __construct ($wikiurl) {
global $__wp__http;
if (!isset($__wp__http)) {
$__wp__http = new http;
}
$this->http = &$__wp__http;
$this->apiurl = 'http://' .$wikiurl. '/w/api.php';
}
#########################################################################################################
################################### FONCTIONS DE CONNEXION ###################################
#########################################################################################################
function login ($user, $pass)
{
$req1 = $this->http->post($this->apiurl.'?action=login&format=php',array('lgname' => $user, 'lgpassword' => $pass));
$req1 = unserialize($req1) ;
$token = $req1['login']['token'];
$req2 = $this->http->post($this->apiurl.'?action=login&format=php',array('lgname' => $user, 'lgpassword' => $pass, 'lgtoken' => $token));
return unserialize ($req2) ;
}
function logout ()
{
return $this->http->get($this->apiurl.'?action=logout');
}
#########################################################################################################
################################### LISTES DE PAGES ###################################
#########################################################################################################
######### listcategories() #########
## ##
## Liste toutes les catégories ##
######################################
function listcategories ($continue=NULL)
{
$append = (!empty($continue)) ? '&acfrom='.urlencode($continue) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=allpages&aplimit=5000&apnamespace=14&format=php'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['allpages']['apfrom'];
return $x['query']['allpages'];
}
######### listpages() #########
## ##
## Liste toutes les pages ##
######################################
function listpages ($continue=NULL)
{
$append = (!empty($continue)) ? '&apfrom='.urlencode($continue) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=allpages&apfilterredir=nonredirects&aplimit=5000&apnamespace=0&format=php'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['allpages']['apfrom'];
return $x['query']['allpages'];
}
######### listredirects() #########
## ##
## Liste tous les redirects ##
######################################
function listredirects ($continue=NULL)
{
$append = (!empty($continue)) ? '&apfrom='.urlencode($continue) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=allpages&apfilterredir=redirects&aplimit='.urlencode($apnumber).'&format=php'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['allpages']['apfrom'];
return $x['query']['allpages'];
}
######### listbyprefix() #########
## ##
## Liste toutes les pages qui ##
## commencent par $prefix ##
######################################
function listbyprefix ($prefix, $namespace = 0, $continue = null)
{
$append = (!empty($continue)) ? '&apfrom='.urlencode($continue) : '' ;
$append .= '&apnamespace='.urlencode($namespace);
$x = $this->http->get($this->apiurl.'?action=query&list=allpages&apprefix='.urlencode($prefix).'&format=php&aplimit='.$count.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['allpages']['apfrom'];
return $x['query']['allpages'];
}
#########################################################################################################
################################### OUTILS DE RECHERCHE ###################################
#########################################################################################################
######### categorymembers() #########
## ##
## Liste les membres de la ##
## catégorie $category ##
######################################
function categorymembers ($category, $continue=NULL)
{
$append = (!empty($continue)) ? '&cmcontinue='.urlencode($continue) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=categorymembers&cmtitle='.urlencode($category).'&format=php&cmlimit=5000'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['categorymembers']['cmcontinue'];
return $x['query']['categorymembers'];
}
######### recentchanges() #########
## ##
## Affiche les RC ##
######################################
function recentchanges ($count = 10, $rcshow=null, $namespace = null, $continue=NULL)
{
$append = (!empty($continue)) ? '&rcstart='.urlencode($continue) : '' ;
$append .= (!empty($rcshow)) ? '&rcshow='.urlencode($rcshow) : '' ;
$append .= (!empty($namespace)) ? '&rcnamespace='.urlencode($rcnamespace) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=recentchanges&rcprop=user|comment|flags|timestamp|title|ids|sizes&rcdir=older&format=php&rclimit='.$count.$append);
$x = unserialize($x);
return $x['query']['recentchanges'];
}
function search ($search,$namespace = 0,$what = 'text',$redirs = false) {
$array_pages = array();
$append = NULL;
if (!empty($this->sroffset)) $append = '&sroffset='.urlencode($this->sroffset) ;
if ($redirs == true) $append .= '&srredirects=1';
$x = $this->http->get($this->apiurl.'?action=query&list=search&format=php&srlimit=49&srnamespace='.urlencode($namespace).'&srwhat='.urlencode($what).'&srsearch='.urlencode($search).$append);
$x = unserialize($x); // srlimit à 49, il devrait être à 500 (bug API)
$this->sroffset = $x['query-continue']['search']['sroffset'];
$array_pages = $x['query']['search'] ;
return $array_pages;
}
#########################################################################################################
################################### INFORMATIONS SUR UNE PAGE ###################################
#########################################################################################################
######### embeddedin() #########
## ##
## Liste les pages dans lesquels ##
## sont inclus le modèle $template ##
######################################
function embeddedin ($template, $continue=NULL)
{
$append = (!empty($continue)) ? '&eicontinue='.urlencode($continue) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=embeddedin&eititle='.urlencode($template).'&format=php&eilimit=5000'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['embeddedin']['eicontinue'];
return $x['query']['embeddedin'];
}
######### getlinks() #########
## ##
## Liste les liens inclus dans ##
## la page $page ##
######################################
function getlinks ($page, $continue=NULL)
{
$append = (!empty($continue)) ? '&plcontinue='.urlencode($continue) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&prop=links&titles='.urlencode($page).'&pllimit=500&plnamespace=0&format=php'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['links']['plcontinue'];
//ATTENTION ! Utiliser foreach
//return $x['query']['pages'][$key]['links'];
}
######### backlinks() #########
## ##
## Liste les pages qui pointent ##
## vers la page $page ##
######################################
function backlinks ($page, $filter = null, $ns=null, $continue = null)
{
$append = (!empty($continue)) ? '&blcontinue='.urlencode($continue) : '' ;
$append .= (!empty($filter)) ? '&blfilterredir='.urlencode($filter) : '' ;
$append .= (!empty($filter)) ? '&blnamespace='.urlencode($ns) : '' ;
$x = $this->http->get($this->apiurl.'?action=query&list=backlinks&bltitle='.urlencode($page).'&format=php&bllimit=5000'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['backlinks']['blcontinue'];
return $x['query']['backlinks'];
}
######### langlinks() #########
## ##
## Liste les interwikis de la ##
## page $page ##
######################################
function langlinks ($page)
{
$x = $this->http->get($this->apiurl.'?action=query&prop=langlinks&titles='.urlencode($page).'&format=php&lllimit=500');
$x = unserialize($x);
foreach ($x['query']['pages'] as $key => $value) {
$iwiki = $x['query']['pages'][$key]['langlinks'];
if (empty($iwiki)) return NULL;
$langs = array();
foreach ($iwiki as $key => $value)
{
$lang = $iwiki[$key]['lang'];
$langs[$lang] = $iwiki[$key]['*'];
}
return $langs;
}
}
#########################################################################################################
################################### INFORMATIONS SUR UN UTILISATEUR ###################################
#########################################################################################################
function logs ($user = null,$title = null,$limit = 500,$type = null,$start = null,$end = null,$dir = 'older') {
$append = '';
if ($user != null) $append.= '&leuser='.urlencode($user);
if ($title != null) $append.= '&letitle='.urlencode($title);
if ($limit != null) $append.= '&lelimit='.urlencode($limit);
if ($type != null) $append.= '&letype='.urlencode($type);
if ($start != null) $append.= '&lestart='.urlencode($start);
if ($end != null) $append.= '&leend='.urlencode($end);
if ($dir != null) $append.= '&ledir='.urlencode($dir);
$x = $this->http->get($this->apiurl.'?action=query&format=php&list=logevents&leprop=ids|title|type|user|timestamp|comment|details'.$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['logevents']['lestart'] ;
return $x['query']['logevents'];
}
function usercontribs ($user,$ucstart) {
$array_pages = array();
$dir = 'older';
$append = NULL;
if (!empty($ucstart)) $append = '&ucstart='.urlencode($ucstart) ;
$x = $this->http->get($this->apiurl.'?action=query&list=usercontribs&ucuser='.urlencode($user).'&ucdir='.urlencode($dir).'&format=php&uclimit=5000'.$append);
$x = unserialize($x);
$this->ucstart = $x['query-continue']['usercontribs']['ucstart'];
return $x['query']['usercontribs'];
}
function users ($start = null,$limit = 1,$group = null,$requirestart = false,&$continue = null) {
$append = '';
if ($start != null) $append .= '&aufrom='.urlencode($start);
if ($group != null) $append .= '&augroup='.urlencode($group);
$x = $this->http->get($this->apiurl.'?action=query&list=allusers&format=php&auprop=blockinfo|editcount|registration|groups&aulimit='.urlencode($limit).$append);
$x = unserialize($x);
$this->continue = $x['query-continue']['allusers']['aufrom'];
if (($requirestart == true) and ($x['query']['allusers'][0]['name'] != $start)) return false;
return $x['query']['allusers'];
}
function contribcount ($user) {
$this->checkurl();
$ret = $this->api->users($user,1,null,true);
if ($ret !== false) return $ret[0]['editcount'];
return false;
}
#########################################################################################################
################################### WIKIPEDIAQUERY ###################################
#########################################################################################################
function getpage ($page)
{
$ret = $this->revisions($page,1,'older',true,null,true,false,false,false);
return $ret[0]['*'];
}
function revisions ($page,$count = 1,$dir = 'older',$content = false,$revid = null,$wait = true,$getrbtok = false,$dieonerror = true,$redirects = false) {
$x = $this->http->get($this->apiurl.'?action=query&prop=revisions&titles='.urlencode($page).'&rvlimit='.urlencode($count).'&rvprop=timestamp|ids|user|comment'.(($content)?'|content':'').'&format=php&meta=userinfo&rvdir='.urlencode($dir).(($revid !== null)?'&rvstartid='.urlencode($revid):'').(($getrbtok == true)?'&rvtoken=rollback':'').(($redirects == true)?'&redirects':''));
$x = unserialize($x);
if ($revid !== null) {
$found = false;
if (!isset($x['query']['pages']) or !is_array($x['query']['pages'])) {
/*if ($dieonerror == true) die('No such page.'."\n");
else*/ return false;
}
foreach ($x['query']['pages'] as $data) {
if (!isset($data['revisions']) or !is_array($data['revisions'])) {
/*if ($dieonerror == true) die('No such page.'."\n");
else*/ return false;
}
foreach ($data['revisions'] as $data2) if ($data2['revid'] == $revid) $found = true;
unset($data,$data2);
break;
}
if ($found == false) {
if ($wait == true) {
sleep(1);
return $this->revisions($page,$count,$dir,$content,$revid,false,$getrbtok,$dieonerror);
} else {
/*if ($dieonerror == true) die('Revision error.'."\n");*/
}
}
}
foreach ($x['query']['pages'] as $key => $data) {
$data['revisions']['ns'] = $data['ns'];
$data['revisions']['title'] = $data['title'];
$data['revisions']['currentuser'] = $x['query']['userinfo']['name'];
// $data['revisions']['currentuser'] = $x['query']['userinfo']['currentuser']['name'];
$data['revisions']['continue'] = $x['query-continue']['revisions']['rvstartid'];
$data['revisions']['pageid'] = $key;
return $data['revisions'];
}
}
function getedittoken () {
$tokens = $this->gettokens('Main Page');
if ($tokens['edittoken'] == '') $tokens = $this->gettokens('Main Page',true);
$this->edittoken = $tokens['edittoken'];
return $tokens['edittoken'];
}
function gettokens ($title,$flush = false) {
if (!is_array($this->tokencache)) $this->tokencache = array();
foreach ($this->tokencache as $t => $data) if (time() - $data['timestamp'] > 6*60*60) unset($this->tokencache[$t]);
if (isset($this->tokencache[$title]) && (!$flush)) {
return $this->tokencache[$title]['tokens'];
} else {
$tokens = array();
$x = $this->http->get($this->apiurl.'?action=query&format=php&prop=info&intoken=edit|delete|protect|move|block|unblock|email&titles='.urlencode($title));
$x = unserialize($x);
foreach ($x['query']['pages'] as $y) {
$tokens['edittoken'] = $y['edittoken'];
$tokens['deletetoken'] = $y['deletetoken'];
$tokens['protecttoken'] = $y['protecttoken'];
$tokens['movetoken'] = $y['movetoken'];
$tokens['blocktoken'] = $y['blocktoken'];
$tokens['unblocktoken'] = $y['unblocktoken'];
$tokens['emailtoken'] = $y['emailtoken'];
$this->tokencache[$title] = array(
'timestamp' => time(),
'tokens' => $tokens
);
return $tokens;
}
}
}
function page_empty ($title) {
$x = $this->http->get($this->apiurl.'?action=query&format=php&prop=info&intoken=edit&titles='.urlencode($title));
$x = unserialize($x);
foreach ( $x['query']['pages'] as $key => $value )
{
if ($x['query']['pages'][$key]['length'] == 0) return TRUE;
else return FALSE;
}
}
function isprotected ($title) {
$x = $this->getprotections ($title) ;
if ($x[0]['type'] == 'edit' && $x[0]['level'] == 'sysop') return TRUE;
else return FALSE;
}
function getprotections ($title) {
$x = $this->http->get($this->apiurl.'?action=query&format=php&prop=info&inprop=protection&titles='.urlencode($title));
$x = unserialize($x);
foreach ( $x['query']['pages'] as $key => $value )
{
$x = $x['query']['pages'][$key]['protection'] ;
return $x;
}
}
function pages_info ($array) {
$titles = '';
foreach ($array as $key => $value)
{
$pn = $array[$key]['title'];
$titles .= (empty($titles)) ? $pn : '|' . $pn ;
}
$x = $this->http->get($this->apiurl.'?action=query&format=php&prop=info&titles='.urlencode($titles));
$x = unserialize($x);
return $x;
}
#########################################################################################################
################################### ACTIONS SUR LE WIKI ###################################
#########################################################################################################
######### edit() #########
## ##
## Edite la page $page ##
######################################
function edit ($page, $data, $summary = '', $minor = true, $bot = true)
{
// On vérifie que l'arrêt d'urgence n'a pas été déclenché
// if ($page != PAGE_ARRET && $page != PAGE_STATUT) $this->arreturgence() ;
$params = Array(
'maxlag' => 5 ,
'action' => 'edit',
'format' => 'php',
'title' => $page,
'text' => $data,
'token' => $this->getedittoken(),
'summary' => $summary,
($minor?'minor':'notminor') => '1',
($bot?'bot':'notbot') => '1'
);
$params['starttimestamp'] = time();
//if ($wpStarttime !== null) $params['starttimestamp'] = $wpStarttime;
//if ($wpEdittime !== null) $params['basetimestamp'] = $wpEdittime;
## Compteur pour limiter les edits par unite de temps
$vt = 10 ;
$tm = ( time() - $this->lastedit ) ;
if ( $tm < $vt ) { sleep($vt - $tm); }
$this->lastedit = time() ;
$params['basetimestamp'] = time() ;
$x = $this->http->post($this->apiurl,$params);
$x = unserialize($x);
if ($x['error']['code']=='maxlag') {
preg_match ("#([0-9]+) seconds lagged#", $x['error']['info'], $flimit) ;
sleep ( $flimit[1] ) ;
$f=fopen('maxlag.txt','a+'); fputs($f,date('d/m/Y H:i:s')."\n"); fclose($f);
$this->edit ($page,$data,$summary,$minor,$bot,$wpStarttime,$wpEdittime,$checkrun) ;
}
#var_export($x);
if ($x['edit']['result'] == 'Success') return true;
else return false;
}
######### move() #########
## ##
## Dépalace la page $old ##
######################################
function move ($old,$new,$reason) {
$tokens = $this->gettokens($old);
$params = array(
'action' => 'move',
'format' => 'php',
'from' => $old,
'to' => $new,
'token' => $tokens['movetoken'],
'reason' => $reason
);
$x = $this->http->post($this->apiurl,$params);
$x = unserialize($x);
#var_export($x);
}
######### rollback() #########
## ##
## Reverte l'utilisateur $user ##
######################################
function rollback ($title,$user,$reason,$token = null) {
if (($token == null) or ($token == '')) {
$token = $this->revisions($title,1,'older',false,null,true,true);
print_r($token);
if ($token[0]['user'] == $user) {
$token = $token[0]['rollbacktoken'];
} else {
return false;
}
}
$params = array(
'action' => 'rollback',
'format' => 'php',
'title' => $title,
'user' => $user,
'summary' => $reason,
'token' => $token,
'markbot' => 1
);
echo 'Posting to API: ';
var_export($params);
$x = $this->http->post($this->apiurl,$params);
$x = unserialize($x);
var_export($x);
return (isset($x['rollback']['summary'])?true:false);
}
#########################################################################################################
################################### AUTRES FONCTIONS ###################################
#########################################################################################################
// If you have an emergency button on your bot userpage :
function arreturgence () {
if ( ! $this->page_empty(PAGE_ARRET) )
{
exit("\nArrêt d'urgence du bot !\n\n");
}
}
}
?>
User:Quentinv57/CaBot/Source/class/wikiadmin.class.php
[modifier | modifier le code]This class only needs to be included if the bot runs with sysop rights.
<?php
class wikipediaadmin {
private $http;
private $apiurl;
function __construct ($wikiurl) {
global $__wp__http;
if (!isset($__wp__http)) {
$__wp__http = new http;
}
$this->http = &$__wp__http;
$this->apiurl = 'http://' .$wikiurl. '/w/api.php';
}
function gettoken ($type) {
if ($type=='protect' || $type=='delete')
{
$x = $this->http->get($this->apiurl . '?action=query&format=php&prop=info&intoken='.$type.'&titles=Main+Page');
$x = unserialize($x);
foreach ($x['query']['pages'] as $y) { $token = $y[$type.'token']; }
}
elseif ($type=='patrol')
{
$x = $this->http->get($this->apiurl . '?action=query&format=php&list=recentchanges&rctoken=patrol&rclimit=1');
$x = unserialize($x);
$token = $x['query']['recentchanges'][0]['patroltoken'];
}
return $token;
}
function protect ($page, $reason='', $protections='edit=sysop|move=sysop', $expiry='infinite', $cascade=NULL) {
$params = Array(
'action' => 'protect',
'format' => 'php',
'title' => $page,
'token' => $this->gettoken('protect'),
'protections' => $protections,
'expiry' => $expiry,
'reason' => $reason,
($cascade?'cascade':'') => '1'
);
$x = $this->http->post($this->apiurl,$params);
$x = unserialize($x);
#var_export($x);
}
function delete ($page, $reason='') {
$params = Array(
'action' => 'delete',
'format' => 'php',
'title' => $page,
'token' => $this->gettoken('delete'),
'reason' => $reason
);
$x = $this->http->post($this->apiurl,$params);
$x = unserialize($x);
#var_export($x);
}
function patrol ($rcid) {
$params = Array(
'action' => 'patrol',
'format' => 'php',
'rcid' => $rcid,
'token' => $this->gettoken('patrol')
);
$x = $this->http->post($this->apiurl,$params);
$x = unserialize($x);
#var_export($x);
}
}
?>