示例#1
0
文件: index.php 项目: Krinkle/xtools
function makeList($votes, $aorb)
{
    global $I18N;
    $output = '<table><tr><td><p>{#considered_usernames#}:</p><ul style="padding-top:5px;">';
    foreach ($votes["altnames"] as $i => $altname) {
        $output .= '<li><a href="//{$domain}/wiki/User:'******'" >' . $altname . '</a></li> ';
    }
    $output .= '</ul>';
    $total = count($votes["support"]) + count($votes["oppose"]) + count($votes["neutral"]) + count($votes["unknown"]);
    $rfxpages = str_replace("_", " ", ucfirst($aorb));
    $output .= '
		<span>' . $I18N->msg('vote_msg', array("variables" => array($votes["altnames"][0], $total, $rfxpages))) . '</span><br />
		<span> 
			{#support#}: ' . count($votes["support"]) . ',  
			{#oppose#}: ' . count($votes["oppose"]) . ', 
			{#neutral#}: ' . count($votes["neutral"]) . ', 
			{#unknown#}: ' . count($votes["unknown"]) . '
		</span></td>
	  ';
    $chdata[] = count($votes["support"]);
    $chdata[] = count($votes["oppose"]);
    $chdata[] = count($votes["neutral"]);
    $chdata[] = count($votes["unknown"]);
    $labels = array($I18N->msg('support'), $I18N->msg('oppose'), $I18N->msg('neutral'), $I18N->msg('unknown'));
    $colors = array('55FF55', 'FF5555', 'CEC7C7', 'E6E68A');
    $output .= '<td><img height="" src="' . xGraph::makeMiniPie($chdata, $labels, $colors) . ' " alt="chart" /></td>';
    $output .= '</tr></table><br />';
    foreach ($votes as $type => $voteresults) {
        if ($type == "altnames") {
            continue;
        }
        $output .= '
				<h4>' . $I18N->msg(ucfirst($type)) . '</h4>
				<table class="leantable tble-condensed, xt-table">
			';
        foreach ($voteresults as $i => $item) {
            $pagetitle = str_replace('_', ' ', preg_replace('/^.*\\/(.*)$/', '\\1', $item["page"]));
            $output .= '
					<tr>
					<td>' . ($i + 1) . '. &nbsp; </td>
					<td style="font-size:90%; padding-right:1em" >' . $item["startdate"] . '</td>
					<td style="font-size:90%" >(<span style="color:green">' . $item["pro"] . '</span>, <span style="color:red">' . $item["contra"] . '</span>, <span style="color:gray">' . $item["neutral"] . '</span>)</td>
					<td style="padding-left:1em" ><a href="//{$domain}/wiki/' . $item["page"] . '" >' . $pagetitle . '</a></td>
					</tr>
				';
        }
        $output .= '</table>';
    }
    return $output;
}
示例#2
0
文件: index.php 项目: Krinkle/xtools
function makeList($items, $nsnames, $nscolors, $wi, $ui, $namespace, $redirects, $limit)
{
    global $wt;
    #print_r($nsnames);
    $lang = $wi->lang;
    $wiki = $wi->wiki;
    $domain = $wi->domain;
    $rowLimit = $limit;
    //( $namespace == "all" ) ? 100 : 5000;
    $result = new stdClass($filter = null, $namespaces = null, $list = null);
    $currentNamespace = "-1";
    $currentNumber = 0;
    foreach ($items as $i => $item) {
        $page = str_replace("_", " ", $item["page_title"]);
        $date = date("Y-m-d", strtotime($item["timestamp"]));
        $ns = $item["namespace"];
        $prefix = $ns ? $nsnames["names"][$ns] . ":" : "";
        $pageurl = rawurlencode(str_replace(" ", "_", $prefix . $item["page_title"]));
        $redirect = $item["page_is_redirect"] == 1 ? "<small> &middot; (redirect)</small>" : "";
        $deleted = $item["type"] == "arc" ? "<small style='color:red' > &middot; ({#deleted#}) </small>" : "";
        //create a new header if namespace changes
        if ($ns != $currentNamespace) {
            $result->list .= "<tr ><td colspan=22 ><h3 id={$ns} >" . $nsnames["names"][$ns] . "</h3></td></tr>";
            $result->namespaces[$ns]["name"] = $nsnames["names"][$ns];
            $currentNamespace = $ns;
            $currentNumber = 0;
            $currentLimit = false;
        }
        if (!isset($result->namespaces[$ns]["num"])) {
            $result->namespaces[$ns]["num"] = 0;
        }
        if (!isset($result->namespaces[$ns]["redir"])) {
            $result->namespaces[$ns]["redir"] = 0;
        }
        if (!isset($result->namespaces[$ns]["deleted"])) {
            $result->namespaces[$ns]["deleted"] = 0;
        }
        $result->namespaces[$ns]["num"] += 1;
        if ($redirect) {
            $result->namespaces[$ns]["redir"] += 1;
        }
        if ($deleted) {
            $result->namespaces[$ns]["deleted"] += 1;
        }
        $currentNumber++;
        if ($currentNumber > $rowLimit) {
            if ($currentLimit) {
                continue;
            }
            $newlimit = 10 * $limit;
            $result->list .= '
					<tr><td colspan=22 style="padding-left:50px; ">
					<a href="//' . XTOOLS_BASE_WEB_DIR . "/pages/?user={$ui->userUrl}&lang={$lang}&wiki={$wiki}&namespace={$ns}&redirects={$redirects}&limit={$newlimit}" . '" ><strong>-{#more#}-</strong></a>
					</td></tr>
				';
            $currentLimit = true;
        } else {
            $result->list .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>{$currentNumber}.</td>\n\t\t\t\t\t<td style='max-width:50%; white-space:wrap; word-wrap:break-word' ><a href=\"//{$domain}/wiki/{$pageurl}?redirect=no\" >{$page}</a> {$redirect} {$deleted}</td>\n\t\t\t\t\t<td style='white-space: nowrap; font-size:95%; padding-right:10px;' >{$date}</td>\n\t\t\t\t\t<td style='white-space: nowrap' ><a href=\"//{$domain}/w/index.php?title=Special:Log&type=&page={$pageurl}\" ><small>log</small></a> &middot; </td>\n\t\t\t\t\t<td style='white-space: nowrap' ><a href=\"//" . XTOOLS_BASE_WEB_DIR . "/articleinfo/?lang={$lang}&wiki={$wiki}&page={$pageurl}\" ><small>page history</small></a> &middot; </td>\n\t\t\t\t\t<td style='white-space: nowrap' ><a href=\"//" . XTOOLS_BASE_WEB_DIR . "/topedits/?lang={$lang}&wiki={$wiki}&user={$ui->userUrl}&page={$pageurl}\" ><small>topedits</small></a></td>\n\t\t\t\t\t\n\t\t\t\t\t</tr>\n\t\t\t\t";
        }
    }
    $result->filterns = $namespace;
    $result->filterredir = $redirects;
    $result->total = count($items);
    unset($items, $nsnames);
    //make serialized lists for graphics & toptable
    $sum["num"] = 0;
    $sum["redir"] = 0;
    $sum["deleted"] = 0;
    $chLabels = array();
    $chValues = array();
    $chColors = array();
    foreach ($result->namespaces as $num => $ns) {
        $result->listnamespaces .= '
			<tr>
			<td style="padding-right:10px">
				<span class=legendicon style="background-color:' . $nscolors[$num] . '"> </span>
				<a href="#' . $num . '" >' . $ns["name"] . '</a>
			</td>
			<td class=tdnum >' . $ns["num"] . '</td>
			<td class=tdnum >' . $ns["redir"] . '</td>
			<td class=tdnum >' . $ns["deleted"] . '</td>
			</tr>
		';
        $sum["num"] += isset($ns["num"]) ? $ns["num"] : 0;
        $sum["redir"] += isset($ns["redir"]) ? $ns["redir"] : 0;
        $sum["deleted"] += isset($ns["deleted"]) ? $ns["deleted"] : 0;
        $chValues[$num] = $ns["num"];
    }
    $result->listnamespaces .= '
			<tr>
			<td style="border-top:3px double silver;" ></td>
			<td class=tdnum style="border-top:3px double silver" ><strong>' . $wt->numFmt($sum["num"], 0, true) . '</strong></td>
			<td class=tdnum style="border-top:3px double silver" >' . $wt->numFmt($sum["redir"], 0, true) . '</td>
			<td class=tdnum style="border-top:3px double silver" >' . $wt->numFmt($sum["deleted"], 0, true) . '</td>
			</tr>
			';
    $result->nschart = '<img height="140px" src="' . xGraph::makePieGoogle($chValues) . '" alt="some graph" />';
    return $result;
}
示例#3
0
文件: index.php 项目: Krinkle/xtools
            $latestother = $latest;
            $latestotherspan = $diffspan;
            $latestotherwiki = $sulwiki;
        }
    }
    $i++;
}
$wt->assign('sulinfotop', $list);
$wt->assign('sulother', $cnt->mRegisteredWikis - count($listedwikis));
$wt->assign('sulothercount', $wt->numFmt($cnt->mTotalGlobal - $listsum));
$wt->assign('latestotherspan', $latestotherspan);
$wt->assign('latestotherwiki', $latestotherwiki);
$wt->assign('sultotal', $wt->numFmt($cnt->mTotalGlobal));
unset($list, $listedwikis);
//Make TimeCard graphics
$imgTimecardBubble = '<img alt="Timecard" src="' . xGraph::makeTimecardBubble($cnt->timeCard["matrix"], $lang) . '" />';
//Output stuff
$groupsGlobal = $cnt->mGroupsGlobal ? " &bull; global: " . implode(", ", $cnt->mGroupsGlobal) : "";
$extendedLink = true || $cnt->extended ? '' : '<small><a href="//tools.wmflabs.org/xtools/ec/?' . $_SERVER['QUERY_STRING'] . '&extended=1 " >Run extended</a></small>';
$wt->assign('runextended', $extendedLink);
$msgDay = $I18N->msg('days', array("variables" => array(1)));
$msgDays = $I18N->msg('days', array("variables" => array(2)));
$wt->assign('avgeditsperdaytext', $I18N->msg('avg_edits_per_time_sign', array("variables" => array($msgDay))));
$wt->assign('xtoolsbase', XTOOLS_BASE_WEB_DIR);
$wt->assign("lang", $lang);
$wt->assign("wiki", $wiki);
$wt->assign("userid", $cnt->mUID);
$wt->assign("username", $cnt->getName());
$wt->assign("usernameurl", rawurlencode($cnt->getName()));
$wt->assign("userprefix", rawurlencode($cnt->mNamespaces["names"][2]));
$wt->assign("domain", $domain);
示例#4
0
文件: index.php 项目: Krinkle/xtools
                    <td>' . $edit[$row['source']] . '</td>
                    <td>' . $row["explain"] . '</td>
                    </tr>';
    }
    $imgbugs = '<img height=20px style="padding-right:8px;margin-bottom:4px;" src="//upload.wikimedia.org/wikipedia/commons/0/04/Icon_attention.png" />';
} else {
    $list .= '<tr><td colspan=22 >No known bugs or errors.</td></tr>';
    $imgbugs = '<img height=18px style="padding-right:7px" src="//upload.wikimedia.org/wikipedia/commons/b/bf/Crystal_button_ok.png" />';
}
$wt->assign('maintenance', $list);
$wt->assign('numbugs', count($ai->checkResults['list']));
$wt->assign('imgbugs', $imgbugs);
unset($list);
//Pageviews
$charttitle = $I18N->msg('pageviews') . " (60 " . $I18N->msg('days', array("variables" => array(2))) . "):  " . $wt->numFmt($ai->pageviews->sumhits);
$cImg = xGraph::makeBarPageViews($charttitle, $ai->pageviews, $wi->lang);
$chartImgPageviews = "<a href=\"//tools.wmflabs.org/wikiviewstats/?latest=60&amp;lang={$lang}&amp;wiki={$wiki}&amp;page={$ai->pagetitleFullUrl}\" ><img class=\"img-responsive\" src=\"" . $cImg . "\" alt='bla' /></a>";
$wt->assign('chartImgPageviews', $chartImgPageviews);
//Assign links
foreach ($ai->links as $link) {
    $wt->assign($link["type"], $wt->numFmt($link["value"]));
}
//tools list
$list = '<table>';
foreach ($ai->data["tools"] as $tool => $count) {
    $list .= '<tr><td>' . $tool . '</td><td> &middot; ' . $wt->numFmt($count) . '</td></tr>';
}
$list .= '</table>';
$wt->assign('toolslist', $list);
$wt->assign("domain", $domain);
$wt->assign("lang", $lang);