Пример #1
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
require_once 'Counter.php';
//Load WebTool class
$wt = new WebTool('Automated Edits', 'autoedits', array());
$wt->setLimits();
$wt->getPageTemplate("form");
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
$ui = $wt->getUserInfo();
$user = $ui->user;
$begin = $wt->checkDate($wgRequest->getVal('begin'));
$end = $wt->checkDate($wgRequest->getVal('end'));
//Show form if &article parameter is not set (or empty)
if (!$lang || !$wiki || !$user) {
    $wt->showPage();
}
$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>
Пример #2
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);