コード例 #1
0
error_reporting(E_ALL | E_STRICT);
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;
コード例 #2
0
}
$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') {
    echo "Login failure\n";
    die;
}
$readbuffer = "";
$startSep = "[[";
$endSep = "]]";
// open a socket connection to the IRC server
$fp = fsockopen($host, $port, $erno, $errstr, 30);
// print the error if there is no connection
if (!$fp) {
    echo $errstr . " (" . $errno . ")<br />\n";
    die;
}
// write data through the socket to join the channel
コード例 #3
0
 /**
  * This is our constructor.
  * @param $myApiurl API url; used if $fromFile is false
  * @param $myQueryurl Query url; used if $fromFile is false
  * @param $myIndexurl Index url; used if $fromFile is false
  * @param $bot Bot name; used if $fromFile is true
  * @param $wiki Wiki name; used if $fromFile is true
  * @param $fromFile If true, load settings from wikibot.config.php
  * @return void
  **/
 function __construct($myApiurl, $myQueryurl, $myIndexurl, $bot = '', $wiki = '', $fromFile = false)
 {
     global $indexFunctionFile;
     if ($fromFile == true) {
         $this->apiurl = getWikibotSetting('apiurl', $bot, $wiki);
         $this->queryurl = getWikibotSetting('queryurl', $bot, $wiki);
         // Obsolete, but kept for compatibility purposes.
         $this->indexurl = getWikibotSetting('indexurl', $bot, $wiki);
     } else {
         $this->apiurl = $myApiurl;
         $this->queryurl = $myQueryurl;
         // Obsolete, but kept for compatibility purposes.
         $this->indexurl = $myIndexurl;
     }
     if (isset($indexFunctionFile)) {
         foreach ($indexFunctionFile as $item) {
             require_once $item;
         }
     }
     global $__wp__http;
     if (!isset($__wp__http)) {
         $__wp__http = new http();
     }
     $this->http =& $__wp__http;
 }