Exemple #1
0
    $userprefix = '';
} else {
    $cnt = new Counter($dbr, $user, $domain, true);
    if ($cnt->optin) {
        $wt->content = getPageTemplate('resultns');
        $nscolon = $page_title = "";
        $nsnames = $cnt->getNamespaces();
        $list = getTopEditsByNamespace($dbr, $wi, $ui, $nsnames, $namespace);
    } else {
        $nsnames = $cnt->getNamespaces();
        $wt->content = getPageTemplate('resultns');
        $list = $I18N->msg("nograph", array("variables" => array($cnt->getOptinLinkLocal(), $cnt->getOptinLinkGlobal()))) . "<br /> " . $I18N->msg('nograph2', array("variables" => array($wt->linkOauthHelp)));
    }
    $userprefix = $nsnames["names"][2];
}
$wt->assign('list', $list);
$wt->assign('page', $nscolon . $page_title);
$wt->assign('urlencodedpage', rawurlencode(str_replace(" ", "_", $nscolon . $page_title)));
$wt->assign('xtoolsbase', XTOOLS_BASE_WEB_DIR);
$wt->assign('lang', $lang);
$wt->assign('wiki', $wiki);
$wt->assign('domain', $domain);
$wt->assign('username', $user);
$wt->assign('userprefix', $userprefix);
$wt->assign('usernameurl', $ui->userUrl);
unset($cnt, $list);
$wt->showPage();
/**************************************** stand alone functions ****************************************
 *
*/
function getPageEditsPerUser($dbr, $page_id, $domain, $users, $wi)
Exemple #2
0
$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)
{
    $history = $pageClass->history(null, 'older', true);
    $list = '';
    $anz = count($history);
    foreach ($history as $id => $rev) {
Exemple #3
0
}
$dbr = $wt->loadDatabase($lang, $wiki);
$cnt = new Counter($dbr, $user, $domain, true);
//Start doing the DB request
$data = $cnt->calcAutoEditsDB($dbr, $begin, $end);
$list = '';
foreach ($data["tools"] as $toolname => $count) {
    $list .= '
				<tr>
				<td><a href="//en.wikipedia.org/wiki/' . Counter::$AEBTypes[$toolname]["shortcut"] . '">' . $toolname . '</a></td>
				<td class="tdnum" >' . $wt->numFmt($count) . '</td>
				</tr>
			';
}
$wt->content = getPageTemplate("result");
$wt->assign('list', $list);
$wt->assign('username', $user);
$wt->assign('usernameurl', rawurlencode($user));
$wt->assign('domain', $domain);
$wt->assign('lang', $lang);
$wt->assign('wiki', $wiki);
$wt->assign('start', $data['start']);
$wt->assign('end', $data['end']);
$wt->assign('totalauto', $wt->numFmt($data['total']));
$wt->assign('totalall', $wt->numFmt($data['editcount']));
$wt->assign('pct', $wt->numFmt($data['pct'], 1));
unset($cnt, $data, $list);
$wt->showPage();
/**************************************** templates ****************************************
 * 
 */
Exemple #4
0
//Output stuff
$wt->content = getPageTemplate("result");
//Make Graphs
$graphNS = xGraph::makePieGoogle($cnt->getNamespaceTotals());
$legendNS = xGraph::makeLegendTable($cnt->getNamespaceTotals(), $cnt->getNamespaces());
$graphMonths = xGraph::makeHorizontalBar("month", $cnt->getMonthTotals(), 800, $cnt->getNamespaces());
$graphYears = xGraph::makeHorizontalBar("year", $cnt->getMonthTotals(), 800, $cnt->getNamespaces());
$gcolor1 = '99CCFF';
$gcolor2 = '99CC00';
$msgBytes = $I18N->msg('bytes');
$gminorpct = $cnt->mMinorEditsByte / $cnt->mLive * 100;
$mdata = array($cnt->mMinorEditsByte, $cnt->mLive - $cnt->mMinorEditsByte);
$mlabels = array("< 20 {$msgBytes} &middot; " . $wt->numFmt($gminorpct, 1) . '%', "≥ 20 {$msgBytes} &middot; " . $wt->numFmt(100 - $gminorpct, 1) . '%');
$mcolors = is_numeric($cnt->mMinorEditsByte) ? array($gcolor1, $gcolor2) : array('cccccc', 'cccccc');
$graphminorbyte = '<img alt="bla" src="' . xGraph::makeMiniPie($mdata, $mlabels, $mcolors, $wi->lang) . '" />';
$wt->assign('graphminorbyte', $graphminorbyte);
$gminorpct = $cnt->mEditsSummary / $cnt->mLive * 100;
$mdata = array($cnt->mLive - $cnt->mEditsSummary, $cnt->mEditsSummary);
$mlabels = array($I18N->msg('no_summary') . ' &middot; ' . $wt->numFmt(100 - $gminorpct, 1) . '%', $I18N->msg('with_summary') . ' &middot; ' . $wt->numFmt($gminorpct, 1) . '%');
$mcolors = array($gcolor1, $gcolor2);
$graphminorbyte = '<img alt="bla" src="' . xGraph::makeMiniPie($mdata, $mlabels, $mcolors, $wi->lang) . '" />';
$wt->assign('grapheditsummary', $graphminorbyte);
//Make list of TopEdited Pages
$wgNamespaces = $cnt->getNamespaces();
$uniqueEdits = $cnt->getUniqueArticles();
ksort($uniqueEdits['namespace_specific']);
$num_to_show = 15;
$out = '<table class="table-condensed table-striped xt-table">';
foreach ($uniqueEdits['namespace_specific'] as $namespace_id => $articles) {
    $out .= '<tr><td colspan=22 ><h3>' . $wgNamespaces['names'][$namespace_id] . '</h3></td></tr>';
    #asort( $articles );
Exemple #5
0
        $redis->setex($hash, $ttl, serialize($cnt));
        $redis->setex($hash2, $ttl, serialize($items));
    }
} else {
    $cnt = unserialize($lc);
    $items = unserialize($lc2);
    unset($lc, $lc2);
    $perflog->add('Pages', 0, 'from Redis');
}
#$perflog->add('items', 0, $items );
//Construct output
$result = makeList($items, $wt->namespaces, xGraph::GetColorList(), $wi, $ui, $namespace, $redirects, $limit);
//Output stuff
$filtertextNS = $namespace == "all" ? $I18N->msg('all') : @$wt->namespaces["names"][$namespace] . " ({$namespace})";
$wt->content = getPageTemplate('result');
$wt->assign('username', $ui->user);
$wt->assign('lang', $lang);
$wt->assign('wiki', $wiki);
$wt->assign('usernameurl', $ui->userUrl);
$wt->assign('userprefix', $wt->namespaces["names"][2]);
$wt->assign('xtoolsbase', XTOOLS_BASE_WEB_DIR);
$wt->assign('domain', $wi->domain);
$wt->assign("redirFilter", $I18N->msg('redirfilter_' . $redirects));
$wt->assign("nsFilter", $filtertextNS);
$wt->assign("namespace_overview", $result->listnamespaces);
$wt->assign("nschart", $result->nschart);
$wt->assign("resultDetails", $result->list);
unset($cnt, $items, $result);
$wt->showPage();
/**************************************** stand alone functions ****************************************
 *
Exemple #6
0
    case "en.wikipedia.org":
        $optionsProject = "\n\t\t\t\t\t<option selected value ='en.wikipedia'>en.wikipedia</option>\n\t\t\t\t\t<option value ='de.wikipedia'>de.wikipedia</option>\n\t\t\t\t\t";
        break;
    case "de.wikipedia.org":
        $optionsProject = "\n\t\t\t\t\t<option value ='en.wikipedia'>en.wikipedia</option>\n\t\t\t\t\t<option selected value ='de.wikipedia'>de.wikipedia</option>\n\t\t\t\t\t";
        break;
    default:
        $wt->toDie('nosupport', $domain);
}
$msgOnDeWiki = "on the German Wikipedia";
$msgOnEnWiki = "on the English Wikipedia";
if ($wt->uselang == "de") {
    $msgOnDeWiki = "in der deutschen Wikipedia";
    $msgOnEnWiki = "in der englischen Wikipedia";
}
$wt->assign('onEnWiki', $msgOnEnWiki);
$wt->assign('onDeWiki', $msgOnDeWiki);
$defaultPage["en.wikipedia.org"] = 'Wikipedia:Requests for adminship/Name of user';
$defaultPage["de.wikipedia.org"] = 'Wikipedia:Adminkandidaturen/Name des Benutzers';
$wt->assign('optionsProject', $optionsProject);
$wt->assign('defaultPage', $defaultPage[$domain]);
$wt->assign('optionsPage', getRecentRfXs($domain));
$p1 = $wgRequest->getVal('page');
$p1 = $wgRequest->getVal('p', $p1);
$p2 = $wgRequest->getVal('page2');
$p2 = $wgRequest->getVal('p2', $p2);
$page = $p2 ? $p2 : $p1;
if (!$page || !$domain || in_array($page, $defaultPage)) {
    $wt->showPage();
}
$page = str_replace(' ', '_', $page);
Exemple #7
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
require_once 'RFAde.php';
require_once 'Graph.php';
require_once PEACHY_BASE_SYS_DIR . '/Peachy/Init.php';
//Load WebTool class
$wt = new WebTool('rfap');
$wt->setLimits();
$wt->getPageTemplate('form');
$wt->assign('optionsProject', '<option selected value ="en.wikipedia.org">en.wikipedia</option><option value = "de.wikipedia.org" >de.wikipedia</option>');
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
$ui = $wt->getUserInfo($lang, $wiki);
$user = $ui->user;
//Show form if username is not set (or empty)
if (!$user || !$lang || !$domain) {
    $wt->showPage();
}
//Check if the user is an IP address
if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/', $name)) {
    $wt->error = "User cannot be an IP.";
    $wt->showPage();
}
$rfa['en'] = 'Requests_for_adminship';
$rfa['de'] = 'Adminkandidaturen';
$rfb['en'] = 'Requests_for_bureaucratship';
$rfb['de'] = 'Bürokratenkandidaturen';
Exemple #8
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
require_once 'RangeContribs.php';
//Load WebTool class
$wt = new WebTool('rangecontribs');
$wt->setLimits();
$wt->getPageTemplate("form");
$wt->assign('defaultBegin', date('Y') . "-01-01");
$wt->content = str_replace('{#tosearch#}', 'CIDR /<br />List', $wt->content);
//Checks for alternative requests for compatibility (ips = legacy)
$list = $wgRequest->getText('ips');
$list = $wgRequest->getText('list', $list);
$list = $wgRequest->getText('text', $list);
$limit = $wgRequest->getVal('limit', '20');
$display = $wgRequest->getVal('display');
$begin = $wt->checkDate($wgRequest->getVal('begin'));
$end = $wt->checkDate($wgRequest->getVal('end'));
$namespace = $wgRequest->getVal('namespace');
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
if (!$list || !$wiki || !$lang) {
    $wt->showPage();
}
if ($begin == 'error' || $end == 'error') {
    $wt->toDie('invalid_date');
}
//Create exec object
Exemple #9
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
//Load WebTool class
$wt = new WebTool('adminstats');
$wt->setLimits();
$wt->getPageTemplate("form");
$datenow = new DateTime();
$datefromdefault = date_format($datenow->sub(new DateInterval("P100D")), "Y-m-d");
$wt->assign('defaultBegin', $datefromdefault);
$datefrom = $wgRequest->getVal('begin', null);
$dateto = $wt->checkDate($wgRequest->getVal('end'));
$wi = $wt->getWikiInfo();
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
$perflog->add('domain', 0, $domain);
$perflog->add('datefrom', 0, $datefrom);
//Show form if domain parameter is not set (or empty)
if (!$domain || !$datefrom) {
    $wt->showPage();
    exit;
}
if ($datefrom == 'default') {
    $datefrom = $datefromdefault;
}
$datefrom = $wt->checkDate($datefrom);
$datediff = '–';
if ($datefrom) {
    $dt = new DateTime($dateto);
Exemple #10
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
//Load WebTool class
$wt = new WebTool('autoblock');
$wt->setLimits();
$wt->getPageTemplate('form');
$wt->assign('defaultUser', '%');
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
$user = $wgRequest->getVal('user');
#	$ui = $wt->getUserInfo();
#		$user = $ui->user;
//Show form if &article parameter is not set (or empty)
if (!$user) {
    $wt->showPage();
}
if (!$domain) {
    $wt->error = "No wiki or project specified - default project set to: en.wikipedia";
    $lang = "en";
    $wiki = "wikipedia";
    $domain = "en.wikipedia.org";
}
$dbr = $wt->loadDatabase($lang, $wiki);
$userdb = $dbr->strencode($user);
$query = "\n   \t\tSELECT ipb_id, ipb_by_text, UNIX_TIMESTAMP(ipb_expiry) as ipb_expiry, ipb_user \n   \t\tFROM ipblocks \n   \t\tWHERE ipb_auto = 1 AND ipb_reason LIKE '%{$userdb}%'\n   \t";
$result = $dbr->query($query);
$list = '<tr><th>#</th><th>id</th><th>expiry</th><th>admin</th><th>action</th></tr>';
Exemple #11
0
} else {
    $ai = unserialize($lc);
    unset($lc);
    $perflog->add('AI', 0, 'from Redis');
}
$perflog->add('create ai', microtime(true) - $m1);
if ($ai->historyCount == 0) {
    $wt->toDie('norevisions', $article);
}
if ($ai->error) {
    $wt->toDie('error', $ai->error);
}
require_once 'Graph.php';
//Now we can assign the Smarty variables!
$wt->content = getPageTemplate("result");
$wt->assign('reloadpurge', '');
#$wt->assign( 'reloadpurge', '<a title="reload & purge" href="//'.XTOOLS_BASE_WEB_DIR."/articleinfo/?".$_SERVER["QUERY_STRING"]."&reloadpurge=".$reloadhash."0".'"><img height=15px src="//upload.wikimedia.org/wikipedia/commons/d/dd/Reload_Icon_Red.svg" /></a>'  );
$msgMonth = $I18N->msg('months', array("variables" => array(1)));
$msgYear = $I18N->msg('years', array("variables" => array(1)));
$wt->assign('avgeditspermonth', $I18N->msg('avg_edits_per_time_sign', array("variables" => array($msgMonth))));
$wt->assign('avgeditsperyear', $I18N->msg('avg_edits_per_time_sign', array("variables" => array($msgYear))));
$wt->assign("page", $ai->pagetitleFull);
$wt->assign("urlencodedpage", $ai->pagetitleFullUrl);
$wt->assign('pageid', $ai->pageid);
$wt->assign("totaledits", $wt->numFmt($ai->data['count']));
$wt->assign("editorcount", $wt->numFmt($ai->data['editor_count']));
$wt->assign("pagesize", $wt->numFmt($ai->data['current_size']));
$wt->assign("minoredits", $wt->numFmt($ai->data['minor_count']));
$wt->assign("minoredits", $wt->numFmt($ai->data['minor_count']));
$wt->assign("anonedits", $wt->numFmt($ai->data['anon_count']));
$wt->assign("minorpct", $wt->numFmt($ai->data['minor_count'] / $ai->data['count'] * 100, 1));
Exemple #12
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
//Load WebTool class
$wt = new WebTool('Edit summary', 'editsummary', array());
$wt->setLimits();
#	$wt->content = getPageTemplate( 'form' );
$wt->assign("lang", "en");
$wt->assign("wiki", "wikipedia");
$namespace = $wgRequest->getVal('namespace');
$redirects = $wgRequest->getVal('redirects');
$wi = $wt->getWikiInfo();
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
$dbr = $wt->loadDatabase($lang, $wiki);
$ui = $wt->getUserInfo();
$user = $wt->user;
#print_r($dbr);
//Get array of namespaces
function getNamespaces()
{
    global $http, $name, $lang, $wiki;
    $namespaces = $http->get('http://' . $lang . '.' . $wiki . '.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces&format=php', false);
    $namespaces = unserialize($namespaces);
    $namespaces = $namespaces['query']['namespaces'];
    if (!$namespaces[0]) {
        toDie('Not a valid wiki.');
    }
    unset($namespaces[-2]);