コード例 #1
0
ファイル: api.php プロジェクト: JackPotte/xtools
);*/
$dbInfo = $fnc->getDBInfo($lang, $wiki);
if (isset($dbInfo['error'])) {
    toDie($phptemp->getConf('nowiki', $url));
}
$wgDBname = $dbInfo['dbname'];
$wgDBserver = $dbInfo['server'];
$dbr = new Database($wgDBserver, $wgDBPort, $wgDBUser, $wgDBPass, $wgDBname, true);
$wgNamespaces = $fnc->getNamespaces('enwiki_p');
$cnt = new Counter($name);
$final_array = array('query' => array('count' => array()));
$retUser = $cnt->getName();
$retIP = $cnt->getIP() ? "true" : "false";
$retExists = $cnt->getExists() ? "true" : "false";
$retUID = $cnt->getUID();
$retDeleted = intval($cnt->getDeleted());
$retLive = intval($cnt->getLive());
$retTotal = intval($cnt->getTotal());
$retGroupList = $cnt->getGroupList();
$retGroupList['_element'] = 'g';
//$retUniqueArticles = $cnt->getUniqueArticles();
//$retUniqueArticleCount = number_format( count($retUniqueArticles['total']) );
$retFirstEdit = $cnt->getFirstEdit();
$retAveragePageEdits = $cnt->getAveragePageEdits();
$retMonthTotals = $cnt->getMonthTotals();
$retNamespaceTotals = $cnt->getNamespaceTotals();
$retOptedIn = $http->getWhichOptIn($cnt->getName());
$final_array['query']['count']['username'] = $retUser;
$final_array['query']['count']['is_ip'] = $retIP;
$final_array['query']['count']['user_exists'] = $retExists;
$final_array['query']['count']['user_id'] = $retUID;
コード例 #2
0
ファイル: index.php プロジェクト: JackPotte/xtools
    $fnc->toDie($phptemp->getConf('nosuchuser', $cnt->getName()));
}
$phptemp->assign("page", $cnt->getName());
$content->assign("username", $cnt->getName());
$content->assign("usernameurl", rawurlencode($cnt->getName()));
$content->assign("url", $url);
$content->assign("loadwiki", "&wiki={$wiki}&lang={$lang}");
if (count($cnt->getGroupList())) {
    $content->assign("groups", implode(', ', $cnt->getGroupList()));
}
if ($cnt->getLive() > 0) {
    $content->assign("firstedit", $cnt->getFirstEdit());
    $content->assign("unique", number_format(count($uniqueEdits['total'])));
    $content->assign("average", $cnt->getAveragePageEdits());
    $content->assign("live", number_format(intval($cnt->getLive())));
    $content->assign("deleted", number_format(intval($cnt->getDeleted())));
    $content->assign("namespacetotals", $graph->legend());
    $content->assign("graph", $graph->pie($phptemp->getConf('namespacetotals')));
    if (in_array($lang . $wiki, $opt_in)) {
        if ($http->isOptedIn($cnt->getName())) {
            $content->assign("monthcounts", $graph->horizontalBar(600));
        } else {
            $content->assign("nograph", $phptemp->getConf("nograph", $cnt->getName(), $url));
        }
    } elseif (in_array($lang . $wiki, $opt_out)) {
        if (!$http->isOptedOut($cnt->getName())) {
            $content->assign("monthcounts", $graph->horizontalBar(600));
        } else {
            $content->assign("nograph", $phptemp->getConf("nograph2", $cnt->getName(), $url));
        }
    } elseif (in_array($lang . $wiki, $no_opt)) {