Exemple #1
0
$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>
				</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));
Exemple #2
0
    $wt->toDie('error. ec::index::cnt -> ' . $cnt->error);
}
require_once 'Graph.php';
//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">';
Exemple #3
0
}
if ($datefrom == 'default') {
    $datefrom = $datefromdefault;
}
$datefrom = $wt->checkDate($datefrom);
$datediff = '–';
if ($datefrom) {
    $dt = new DateTime($dateto);
    $df = new DateTime($datefrom);
    $datediff = $df->diff($dt, true)->format('%a') . ' ' . $I18N->msg('days', array("variables" => array(2)));
}
$dbr = $wt->loadDatabase($lang, $wiki);
$list = getAdminStats($dbr, $wi, $datefrom, $dateto);
$wt->content = getPageTemplate('result');
$wt->assign('list', $list);
$wt->assign('numcuradmins', $wt->numFmt(count($curAdmins)));
$wt->assign('noactionadmins', $wt->numFmt($noActionAdmin));
$wt->assign('pctnoaction', $wt->numFmt($pctnoaction, 1));
$wt->assign('domain', $domain);
$wt->assign('datefrom', $wt->dateFmt($datefrom . ' 00:00:00'));
$wt->assign('numdays', $datediff);
unset($list, $curAdmins);
$wt->showPage();
function getCurrentAdmins($wi)
{
    global $wt, $perflog;
    $stime = microtime(true);
    $res = array();
    $apibase = "http://{$wi->domain}/w/api.php?";
    $data = array("action" => "query", "list" => "allusers", "format" => "json", "augroup" => "sysop|bureaucrat|steward|oversight|checkuser", "auprop" => "groups|editcount", "aufrom" => "", "aulimit" => "500");
    $continue = true;
Exemple #4
0
 }
 $b3 = number_format(microtime(true) - $ptime, 3);
 $ptime = microtime(true);
 $style = $wi->lang == "ru" ? ";display:block;padding-top:15px;" : "";
 $outerspan = '<span style="line-height:1.5em;' . $style . '" >';
 if (in_array($lang, array('he', 'fa', 'ar'))) {
     $outerspan = '<span class="mw-content-rtl" dir="rtl" >';
 }
 $checkcolor = $ai->checkResults['color'];
 $linkData = array('<table>', '<tr><td colspan=2 >Results:</td></tr>', '<tr><td>Checkwiki:</td><td>' . $ai->checkResults['sources']['checkwiki'] . '</td></tr>', '<tr><td><a href="//www.wikidata.org/wiki/' . $wditemid . '" >Wikidata:</a></td><td>' . $ai->checkResults['sources']['wikidata'] . '</td></tr>', '<tr><td><a href="//tools.wmflabs.org/languagetool/pageCheck/index?url=' . rawurlencode($pagetitle) . '&lang=' . $wi->lang . '" >LanguageTool:</a></td><td>' . $ai->checkResults['sources']['languagetool'] . '</td></tr>', '<tr><td>Dead links:</td><td style="white-space:nowrap;">' . $ai->deadlinks . '</td></tr>', '</table>');
 $checktitle = '<div id="xt-gadget-summary" class="menu" style="top:1.3em;padding:1em;z-index:20; direction: ' . $wi->direction . '" >' . implode('', $linkData) . '</div>';
 $linkData = array("pageid" => $pageid, "project" => $domain, "uselang" => $uselang);
 $style = '<style>div.vectorMenu {direction: ' . $wi->direction . ';float: left;cursor: pointer;position: relative;} div.vectorMenu:hover div.menu {display:block;} div.menu {min-width: 100%;position: absolute;top: 2.5em;left: -1px;background-color: white;border: solid 1px silver;border-top-width: 0;clear: both;text-align: left;display: none;} .xt-badge{display:inline-block;min-width:10px;padding:3px 5px;font-size:12px;font-weight:bold;color:rgb(255,255,255);line-height:1;vertical-align:baseline;white-space:nowrap;text-align:center;background-color:rgb(210,210,210);border-radius:2px;cursor:pointer}.xt-badge > div{display:none;text-align:left;top:15px;left:0px}.xt-badge:hover > div{display:block;}.xt-badge-unread{background-color:rgb(204,0,0);}</style>';
 $xtoolsPhLink = '&nbsp;&middot;&nbsp;' . $style . '<div class="vectorMenu" style="float:none;display:inline-block" ><a style=" ' . $checkcolor . '" title="" href="//tools.wmflabs.org/xtools/articleinfo/index.php?' . http_build_query($linkData) . '" >' . htmlspecialchars($I18N->msg('see_full_page_stats'), ENT_QUOTES) . '</a>' . $checktitle . '</div>';
 $linkData = array("user" => $ai->data['first_edit']['user'], "lang" => $lang, "wiki" => $wiki, "uselang" => $uselang);
 $xtoolsEcLink = '<a style="border-bottom:1px dotted " title="SUL ' . $I18N->msg('editcounter', array("escape" => "htmlentities")) . ' (' . htmlspecialchars($I18N->msg('approximate'), ENT_QUOTES) . '). ' . htmlspecialchars($I18N->msg('see_full_edit_counts'), ENT_QUOTES) . '." href="//tools.wmflabs.org/xtools/ec/index.php?' . http_build_query($linkData) . '" >' . $wt->numFmt($ai->data['first_edit']['user_count']) . '</a>';
 if ($lang == "commons") {
     $wiki = "m";
 }
 $linkData = array("lang" => $lang, "project" => $wiki, "locale" => $uselang, "page" => $pagetitle, "latest" => "30");
 $pageviewsText = $I18N->msg('pageviews', array("escape" => "htmlentities")) . ' (30 ' . $I18N->msg('days', array("variables" => array(60), "escape" => "htmlentities")) . ')';
 $pageviewsLink = '<a title="Wiki ViewStats" href="//tools.wmflabs.org/wikiviewstats/?' . http_build_query($linkData) . '" >' . $pageviewsText . '</a>';
 $diff = $wt->datediff(new DateTime($ai->latestRev->timestamp));
 $diffspan = '<span title="' . htmlspecialchars($I18N->msg('latestedit'), ENT_QUOTES) . '" style="color:' . $diff->diffcolor . '" ><small> (<a style="color:inherit" href="//' . $wi->domain . '/w/index.php?diff=' . $ai->latestRev->revid . '" >' . $diff->difftxt . '</a>)</small></span>';
 $messageLink = str_replace("\n", " ", @$wt->statusLink['message']);
 $messageLink = !$messageLink ? str_replace('{$linktext}', '', $wt->statusLink['agentconfig']) . '&nbsp;' : $messageLink . '&nbsp;&nbsp;';
 $mainAuthor = isset($ai->mainAuthor) ? ', <a title="WikiHistory" href="//tools.wmflabs.org/wikihistory/wh.php?page_id=' . $pageid . '" >Hauptautor</a>: ' . $ai->mainAuthor : '';
 $data = array(!$conf->showRevision ? null : '<em>' . $wt->numFmt($ai->data['count']) . '</em> ' . htmlspecialchars($I18N->msg('revisions', array("variables" => array($ai->data['count']))), ENT_QUOTES) . $diffspan, !$conf->showAuthor ? null : '<em>' . $wt->numFmt($ai->data['editor_count']) . '</em> ' . htmlspecialchars($I18N->msg('authors', array("variables" => array($ai->data['editor_count']))), ENT_QUOTES), !$conf->showWatcher ? null : '<em>' . $wt->numFmt($ai->pagewatchers) . '</em> ' . htmlspecialchars($I18N->msg('pagewatchers'), ENT_QUOTES), !$conf->showPageview ? null : '<em>' . $wt->numFmt($ai->pageviews->sumhits) . '</em> ' . $pageviewsLink, !$conf->showCreatedby ? null : $I18N->msg('createdby') . ': <a href="//' . $wi->domain . '/wiki/User:'******'first_edit']['user'] . '">' . $ai->data['first_edit']['user'] . '</a> (' . $rlm . $xtoolsEcLink . ')' . $rlm, !$conf->showMainauthor ? null : $mainAuthor);
 if ($test == "test") {
     if ($mode == 'silent') {
         $style = 'min-width: 7px;border-radius: 2px;padding: 0.25em 0.45em 0.2em 0.45em;margin-left: -4px;text-align: center;background-color: #d2d2d2;font-weight: bold;color: white;cursor: pointer;text-decoration: none;';
Exemple #5
0
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
//Show form if &article parameter is not set (or empty)
if (!$user) {
    $wt->showPage();
}
$dbr = $wt->loadDatabase($lang, $wiki);
$obj = getEditCounts($dbr, $user);
$wt->content = '
		<br />
		<table class="leantable table-condensed xt-table" >
			<tr><td>{#username#}: </td><td><a href="//' . $lang . '.' . $wiki . '.org/wiki/User:'******'" >' . $user . '</a></td></tr>
			<tr><td>{#userid#}: </td><td>' . $obj->id . '</td></tr>
			<tr><td>{#groups#}: </td><td>' . $obj->groups . '</td></tr>
			<tr><td>{#deleted_edits#}: </td><td>' . $wt->numFmt($obj->deleted) . '</td></tr>
			<tr><td>{#live#}: </td><td>' . $wt->numFmt($obj->live) . '</td></tr>
			<tr><td>{#total#}: </td><td><b>' . $wt->numFmt($obj->live + $obj->deleted) . '</b></td></tr>
		</table>
	';
$wt->showPage();
function getEditCounts($dbr, $user)
{
    $name = $dbr->strencode($user);
    $query = " \n\t\t\tSELECT 'id' as source, user_id as value FROM user WHERE user_name = '{$name}' \n\t\t\tUNION\n\t\t\tSELECT 'arch'as source, COUNT(*) AS value FROM archive_userindex WHERE ar_user_text = '{$name}'\n\t\t\tUNION\n\t\t\tSELECT 'rev' as source, COUNT(*) AS value FROM revision_userindex WHERE rev_user_text = '{$name}'\n\t\t\tUNION\n\t\t\tSELECT 'groups' as source, ug_group as value FROM user_groups JOIN user on user_id = ug_user WHERE user_name = '{$name}'\n\t\t";
    $res = $dbr->query($query);
    $obj = new stdClass();
    foreach ($res as $row) {
        if ($row["source"] == "id") {
            $obj->id = $row["value"];
        }
Exemple #6
0
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));
$wt->assign("anonpct", $wt->numFmt($ai->data['anon_count'] / $ai->data['count'] * 100, 1));
$wt->assign('botedits', $wt->numFmt($ai->data['botedit_count']));
$wt->assign('boteditspct', $wt->numFmt($ai->data['botedit_count'] / $ai->data['count'] * 100, 1));
$wt->assign("autoedits", $wt->numFmt($ai->data['automated_count']));
$wt->assign("autoeditspct", $wt->numFmt($ai->data['automated_count'] / $ai->data['count'] * 100, 1));
$wt->assign("firstedit", $wt->dateFmt(date('Y-m-d H:i:s', strtotime($ai->data['first_edit']['timestamp']))));
$wt->assign("firstuser", $ai->data['first_edit']['user']);
$wt->assign("latestedit", $wt->dateFmt(date('Y-m-d H:i:s', strtotime($ai->data['last_edit']['timestamp']))));
$wt->assign("latestuser", $ai->data['last_edit']['user']);