Example #1
0
# RPEDIRC.php by Tisane, http://www.mediawiki.org/wiki/User:Tisane
#
# This script is free software that is available under the terms of the Creative Commons
# Attribution 3.0 license and the current version of the GNU General Public License.
#
# The purpose of this script is to get the titles of all new, moved, deleted and restored
# pages from #en.wikipedia and add/delete them from the rped_table.
error_reporting(E_ALL | E_STRICT);
include 'wikibot.classes.php';
/* The wikipedia classes. */
$bot = $argv[1];
$wiki = $argv[2];
if (!isset($argv[3]) || $argv[3] != "nodaemon") {
    $daemonize = true;
}
$wpapi = new wikipediaapi('', '', '', $bot, $wiki, true);
$wpq = new wikipediaquery('', '', '', $bot, $wiki, true);
$wpi = new wikipediaindex('', '', '', $bot, $wiki, true);
$user = getWikibotSetting('user', $bot, $wiki);
$pass = getWikibotSetting('pass', $bot, $wiki);
$host = getWikibotSetting('host', $bot, $wiki);
$port = getWikibotSetting('port', $bot, $wiki);
$nick = getWikibotSetting('nick', $bot, $wiki);
$ident = getWikibotSetting('ident', $bot, $wiki);
$realname = getWikibotSetting('realname', $bot, $wiki);
$chan = getWikibotSetting('chan', $bot, $wiki);
$deleteLine = getWikibotSetting('deleteline', $bot, $wiki);
$moveLine = getWikibotSetting('moveline', $bot, $wiki);
$deletedWord = getWikibotSetting('deletedword', $bot, $wiki);
$newCharacter = getWikibotSetting('thenewcharacter', $bot, $wiki);
if ($wpapi->login($user, $pass) != 'true') {
Example #2
0
 /**
  * Sends an email to a user.
  * @param $user Username to send email to.
  * @param $subject Subject of email to send.
  * @param $body Body of email to send.
  * @return HTML content.
  **/
 function email($user, $subject, $body)
 {
     $wpapi = new wikipediaapi();
     $wpapi->apiurl = str_replace('index.php', 'api.php', $this->indexurl);
     if (!$this->edittoken or $this->edittoken == '') {
         $this->edittoken = $wpapi->getedittoken();
     }
     $post = array('wpSubject' => $subject, 'wpText' => $body, 'wpCCMe' => 0, 'wpSend' => 'Send', 'wpEditToken' => $this->edittoken);
     return $this->http->post($this->indexurl . '?title=Special:EmailUser&target=' . urlencode($user) . '&action=submit', $post);
 }
Example #3
0
// =============== WARNING ===============
// This file uses the global mysql connection.
// Do not use this code with other code that uses mysql.
// =============== WARNING ===============
ini_set('memory_limit', '1512M');
/**
 * Script for converting the mapping database to wiki templates.
 */
include '../databaseconfig.php';
require_once 'wikibot.classes.php';
// information about classes and properties
$classFile = "classes/classes";
$end = ".html";
$propertyFile = "properties.txt";
$token = "";
$w = new wikipediaapi();
echo $w->login($luser, $lpass);
$page = PREFIX . 'Actor';
$data = "test";
echo $w->edit($page, $data, $summary = 'ddd');
die;
//$token = login($mwuser, $mwpass);
/*
print_r($token);
die;
*/
// actual mappings
$mappingsFile = "mappings.txt";
//$baseURL = 'http://meta.wikimedia.org/wiki/DBpedia/ontology/';
$dbname = 'dbpedia_extraction_en';
//$baseURL = 'http://meta.wikimedia.org/w/index.php?title=DBpedia/ontology/';
Example #4
0
//Tell footer.php to output source
/*function outputSource( $msg ) {
	echo "<li>
	<a href=\"https://svn.cluenet.org/viewvc/soxred93/trunk/bots/Tools/editsummary/index.php?view=markup\">View source</a>
	</li>";
}*/
if (!isset($_GET['name'])) {
    toDie('Welcome to the RfA Vote Calculator!<br />Kudos to SQL for the code!<br />
		<form action="index.php" method="get">
		Username: <input type="text" name="name" /><br />
		<input type="submit" />
		</form>');
}
$http = new http();
$wpq = new wikipediaquery();
$wpapi = new wikipediaapi();
$name = mysql_escape_string(ucfirst(ltrim(rtrim($_GET['name']))));
$oldname = $_GET['name'];
$names_old = array();
//Check if the user is an IP address
if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/', $name)) {
    toDie('Cannot be an IP.');
}
$wlh = $wpapi->backlinks('User:'******'redirects', false);
foreach ($wlh as $bl) {
    $names_old[] = $bl['title'];
}
//Connect to database
require_once '/data/project/xtools/database.inc';
$mysql = mysql_connect('enwiki.labsdb', $toolserver_username, $toolserver_password);
@mysql_select_db('enwiki_p', $mysql) or toDie("MySQL error, please report to X! using <a href=\"//en.wikipedia.org/wiki/User:X!/Bugs\">the bug reporter.</a> Be sure to report the following SQL error when reporting:<br /><pre>" . mysql_error() . "</pre>");
include 'wikibot.classes.php';
/* The wikipedia classes. */
$bot = $argv[1];
$wiki = $argv[2];
$fileName = $argv[3];
$searching = false;
if (isset($argv[4]) && $argv[4] != '') {
    $searching = true;
}
if (!isset($argv[5]) || $argv[5] != "nodaemon") {
    $daemonize = true;
}
$user = getWikibotSetting('user', $bot, $wiki);
$pass = getWikibotSetting('pass', $bot, $wiki);
$maxURLLength = getWikibotSetting('maxurllength', $bot, $wiki);
$wpapi = new wikipediaapi('', '', '', $bot, $wiki, true);
$wpq = new wikipediaquery('', '', '', $bot, $wiki, true);
$wpi = new wikipediaindex('', '', '', $bot, $wiki, true);
if ($wpapi->login($user, $pass) != 'true') {
    echo "Login failure\n";
    die;
}
$handle = @fopen($fileName, "r");
$lineNumber = 0;
$line = "";
if (isset($daemonize)) {
    $pid = pcntl_fork();
    // fork
    if ($pid < 0) {
        exit;
    } else {