Beispiel #1
0
 public static function getBlameResult($wiki, $article, $nofollowredir, $text)
 {
     try {
         $site = Peachy::newWiki(null, null, null, 'http://' . $wiki . '/w/api.php');
     } catch (Exception $e) {
         return null;
     }
     $pageClass = $site->initPage($article, null, !$nofollowredir);
     $title = $pageClass->get_title();
     $history = $pageClass->history(null, 'older', true);
     $revs = array();
     foreach ($history as $id => $rev) {
         if ($id + 1 == count($history)) {
             if (in_string($text, $rev['*'], true)) {
                 $revs[] = self::parseRev($rev, $wiki, $title);
             }
         } else {
             if (in_string($text, $rev['*'], true) && !in_string($text, $history[$id + 1]['*'], true)) {
                 $revs[] = self::parseRev(${$rev}, $wiki, $title);
             }
         }
         unset($rev);
         //Saves memory
     }
     return $revs;
 }
Beispiel #2
0
<?php

ini_set('memory_limit', '5G');
echo "----------STARTING UP SCRIPT----------\nStart Timestamp: " . date('r') . "\n\n";
require_once '/home/cyberpower678/Peachy/Init.php';
require_once '/home/cyberpower678/database.inc';
$site = Peachy::newWiki("wikidata");
$site->set_runpage(null);
$sitemeta = Peachy::newWiki("meta");
$active = '#ccffcc';
$lowactive = '#ffcccc';
$inactive = '#CCCCCC';
$activecell = "| style=\"background:{$active}\" | ";
$lowactivecell = "| style=\"background:{$lowactive}\" | ";
$inactivecell = "! style=\"background:{$inactive}\" | ";
$logquery = array('list' => 'logevents', '_code' => 'le', '_limit' => -1, 'leprop' => 'timestamp|details', 'letype' => 'rights', 'ledir' => 'older');
$editquery = array('list' => 'usercontribs', 'ucstart' => date('Ymdhis', strtotime('-6 months', time())), 'ucdir' => 'newer', 'ucnamespace' => '8', '_limit' => -1, '_code' => 'uc');
while (true) {
    echo "----------RUN TIMESTAMP: " . date('r') . "----------\n\n";
    $db = mysqli_connect('wikidatawiki.labsdb', $toolserver_username, $toolserver_password, 'wikidatawiki_p');
    $admins = $site->allusers(null, array('sysop'), null, false, array(), -1);
    $bureaucrats = $site->allusers(null, array('bureaucrat'), null, false, array(), -1);
    $oversighters = $site->allusers(null, array('oversight'), null, false, array(), -1);
    $cratright = array();
    $adminright = array();
    $outarray = array();
    $timestamp = date('Ymdhis', strtotime('-6 months', time()));
    $out = "<big>This is a table of Administrators, Bureaucrats, and Oversighters.<br>This table provides information such as when the person became that type of user, how many actions they have performed with in the last timeframe, and if they are inactive as defined by the rules on Wikidata.<br>This table has the following parameters:<br>Activity timeframe: '''6 months'''<br>Inactivity: ''Defined as less than '''5''' admin actions''</big>\n\n{| class=\"wikitable\"\n|-\n| style=\"background:#ccffcc\" | Active\n| style=\"background:#ffcccc\" | Slipping into Inactivity\n! style=\"background:#CCCCCC\" | Inactive\n|}\n{| class=\"wikitable\"\n|-\n! Administrators !! Bureaucrats !! Oversighters\n";
    //get the information
    echo "Checking administrators...\n\n";
    foreach ($admins as $user) {
Beispiel #3
0
//Get params from query string
$article = $wgRequest->getVal('article');
$article = $wgRequest->getVal('page', $article);
$nofollowredir = $wgRequest->getBool('nofollowredir');
$text = $wgRequest->getText('text');
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
//Show form if &article parameter is not set (or empty)
if ($lang == "" || $wiki == "" || $article == "" || $text == "") {
    $wt->showPage();
}
// execute the main logic
$pgVerbose = array();
$site = Peachy::newWiki(null, null, null, "http://{$wi->domain}/w/api.php");
$pageClass = $site->initPage($article, null, !$nofollowredir);
$title = $pageClass->get_title();
$list = getBlameResult($pageClass, $text);
$wt->content = getPageTemplate('result');
$wt->assign('list', $list);
$wt->assign('domain', $domain);
$wt->assign('lang', $lang);
$wt->assign('wiki', $wiki);
$wt->assign('searchtext', htmlspecialchars($text));
$wt->assign('page', htmlspecialchars($title));
$wt->assign('urlencodedpage', rawurlencode(str_replace(" ", "_", $prefix . $title)));
$wt->assign('xtoolsbasedir', XTOOLS_BASE_WEB_DIR);
unset($base, $revs, $result);
$wt->showPage();
function getBlameResult(&$pageClass, $text)
Beispiel #4
0
<?php

ini_set('memory_limit', '16M');
echo "----------STARTING UP SCRIPT----------\nStart Timestamp: " . date('r') . "\n\n";
require_once '/home/cyberpower678/Peachy/Init.php';
$site = Peachy::newWiki("cyberbotii");
$site->set_runpage("User:Cyberbot II/Run/PC");
while (true) {
    echo "----------RUN TIMESTAMP: " . date('r') . "----------\n\n";
    $request = $site->get_http()->get('https://en.wikipedia.org/w/index.php?title=Special:StablePages&offset=&limit=500000000');
    $timestamp = date('Y-m-d\\TH:i:s\\Z');
    if (!preg_match('/mw\\.config\\.set\\(\\{\\"wgBackendResponseTime\\"\\:(.*?)\\,\\"wgHostname\\"\\:\\"(.*?)\\"\\}\\)\\;/i', $request)) {
        echo "Site failure";
        exit(1);
    }
    $templatelist1 = initPage("Template:Pp-pc1")->embeddedin();
    $templatelist2 = initPage("Template:Pp-pc2")->embeddedin();
    echo "Retrieving Protected Pages...\n";
    preg_match_all('/' . '\\<li\\>\\<a href=\\".*?\\"\\s*title=\\".*?\\"\\>(.*?)\\<\\/a\\>.*?\\[autoreview=(autoconfirmed|review)\\]\\<i\\>(\\s*\\(expires\\s*(.*?\\s*\\(UTC\\))\\))?\\<\\/i\\>\\<\\/li\\>/i', $request, $list);
    $names = $list[1];
    $level = $list[2];
    $expiry = $list[4];
    echo "Retrieved protected pages.\n";
    //Tag each page with a protection template
    foreach ($names as $i => $page) {
        echo "Processing " . $page . "...\nLevel: {$level[$i]}; Expires: {$expiry[$i]}\n";
        $object = $site->initPage($page, null, false, true, $timestamp);
        $text = $object->get_text();
        if (empty($text)) {
            continue;
        }
Beispiel #5
0
/**
 * Generates a diff between two strings
 *
 * @package Text_Diff
 * @deprecated since 18 June 2013
 */
function getTextDiff()
{
    Peachy::deprecatedWarn('getTextDiff()', 'Diff::load()');
    $args = func_get_args();
    return call_user_func_array(array('Diff', 'load'), $args);
}
Beispiel #6
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
require_once '/data/project/jarry-common/public_html/global.php';
require_once '/data/project/jarry-common/public_html/peachy/Init.php';
$site = Peachy::newWiki();
$username = isset($_GET['username']) && $_GET['username'] != "" ? $_GET['username'] : false;
$start = isset($_GET['start']) && preg_match('/^20[012][0-9]-?[01][0-9]-?[0-3][0-9]$/', $_GET['start']) ? $_GET['start'] : '2015-01-01';
$end = isset($_GET['end']) && preg_match('/^20[012][0-9]-?[01][0-9]-?[0-3][0-9]$/', $_GET['end']) ? $_GET['end'] : '2016-01-01';
echo get_html('header', 'ByteCount generator');
if ($username === false) {
    ?>
	<form action="index.php" method="get">
			<p><label>
				Username:
				<input name="username" type="text" value="<?php 
    echo $username === false ? '' : $username;
    ?>
"/>
			</label></p>
			<p><label>
Beispiel #7
0
 static function loadPeachy()
 {
     global $url, $pgVerbose, $site;
     $pgVerbose = array();
     /*$pgHooks['StartLogin'][] = 'fixlogin';
       function fixlogin( &$config ) {
          $config['httpecho'] = true;
       }*/
     echo "<!--";
     $site = Peachy::newWiki(null, null, null, 'http://' . $url . '/w/api.php');
     echo "-->";
 }
Beispiel #8
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
include '/data/project/xtools/public_html/common/header.php';
//include( '/data/project/xtools/wikibot.classes.php' );
echo "<!--";
require_once '/data/project/xtools/Peachy/Init.php';
echo "-->";
include '/data/project/xtools/rfalib4.php';
echo "<!--";
$site = Peachy::newWiki(null, null, null, 'http://en.wikipedia.org/w/api.php');
echo "-->";
$wiki = new HTTP();
$wikipedia = "//en.wikipedia.org/wiki/";
function print_h_l($var, $searchlist)
{
    if (empty($var)) {
        echo "<ul><li>No items in list</li></ul>";
    }
    echo "<ol>";
    foreach ($var as $vr) {
        $iffy = False;
        if (isset($vr['iffy'])) {
            $iffy = $vr['iffy'];
        }
        if (isset($vr['error'])) {
Beispiel #9
0
 /**
  * Alias of embeddedin
  *
  * @see Page::embeddedin()
  * @deprecated since 18 June 2013
  * @param null $namespace
  * @param null $limit
  * @return array
  */
 public function get_transclusions($namespace = null, $limit = null)
 {
     Peachy::deprecatedWarn('Page::get_transclusions()', 'Page::embeddedin()');
     return $this->embeddedin($namespace, $limit);
 }
Beispiel #10
0
 /**
  * Returns array of pages that embed (transclude) the page given.
  *
  * @see Page::embeddedin()
  * @access public
  * @param string $title The title of the page being embedded.
  * @param array $namespace Which namespaces to search (default: null).
  * @param int $limit How many results to retrieve (default: null i.e. all).
  * @return array A list of pages the title is transcluded in.
  */
 public function embeddedin($title, $namespace = null, $limit = 50)
 {
     Peachy::deprecatedWarn('Wiki::embeddedin()', 'Page::embeddedin()');
     $page = $this->initPage($title);
     return $page->embeddedin($namespace, $limit);
 }