예제 #1
0
파일: index.php 프로젝트: Krinkle/xtools
$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';
// Calculate all the things
$dbr = $wt->loadDatabase($lang, 'wikipedia');
$pgVerbose = array();
$site = Peachy::newWiki(null, null, null, "http://{$wi->domain}/w/api.php");
$votes = get_rfap($dbr, $site, $domain, $user, $rfa[$lang]);
$listAdmin = makeList($votes, $rfa[$lang]);
$votes = get_rfap($dbr, $site, $domain, $user, $rfb[$lang]);
$listBureaucrat = makeList($votes, $rfb[$lang]);
$wt->content = getPageTemplate('result');
$wt->assign('listadmin', $listAdmin);
$wt->assign('listbureaucrat', $listBureaucrat);
$wt->assign('rfa', str_replace('_', ' ', $rfa[$lang]));
$wt->assign('rfb', str_replace('_', ' ', $rfb[$lang]));
$wt->assign('username', $user);
$wt->assign('usernameurl', rawurlencode($user));
$wt->assign('domain', $domain);
$wt->assign('wiki', $lang);
예제 #2
0
파일: index.php 프로젝트: Krinkle/xtools
$uinput = explode("|", $wgRequest->getVal('user'));
foreach ($uinput as $uitem) {
    $tmpui = $wt->getUserInfo($lang, $wiki, $uitem);
    if ($tmpui->userid || $tmpui->isIP) {
        $users["list"][] = $tmpui;
        $users["names"][] = "'" . $tmpui->userDb . "'";
    }
}
$perflog->stack[] = $users;
$ui = $users["list"][0];
$user = $ui->user;
//Show form if &article parameter is not set (or empty)
if (!$user && (!$page || !$lang || !$wiki || strval($namespace) == "")) {
    $wt->showPage();
}
$dbr = $wt->loadDatabase($lang, $wiki);
if ($page) {
    $site = $wt->loadPeachy($lang, $wiki);
    try {
        $pageObj = new Page($site, $page);
        $nsname = $pageObj->get_namespace(false);
        $nsid = $pageObj->get_namespace();
        $nscolon = $nsid ? $nsname . ":" : "";
        $page_title = $pageObj->get_title(false);
        $page_id = $pageObj->get_id();
    } catch (Exception $e) {
        $wt->error = $e->getMessage() . " (topedits::pageObj)";
        $wt->showPage();
    }
    if (!$page_id || $page_id == 0) {
        $wt->toDie('nosuchpage', $page . " ({$domain})");
예제 #3
0
파일: api.php 프로젝트: Krinkle/xtools
     $conf->showMainauthor = @$confread->showMainauthor;
     if ($confread->uselang != 'default') {
         $uselang = $confread->uselang;
         $I18N->setLang($uselang);
     }
     if ($reenable) {
         $confread->status = 'enabled';
         $redis->setex('xagconfig' . session_id(), 86400, json_encode($confread));
     }
 }
 $wi = $wt->getWikiInfo(null, null, $db);
 $lang = $wi->lang;
 $wiki = $wi->wiki;
 $domain = $wi->domain;
 $rlm = $wi->rlm;
 $dbr = $wt->loadDatabase(null, null, $db);
 $ai = new ArticleInfo($dbr, $wi, $pagetitle, null, null, false, $pageid, $conf, $nsid, $wditemid);
 if (!$ai->data['editor_count']) {
     throw new Exception('nodata');
 }
 $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);