예제 #1
0
파일: index.php 프로젝트: Krinkle/xtools
			<td class="revtext break" ><span title="' . htmlspecialchars($row['rev_comment'], ENT_QUOTES) . '">' . mb_strimwidth(htmlspecialchars(preg_replace('/[\\r\\n]/', '', $row['rev_comment']), ENT_QUOTES), 0, 60, '...') . '</span></td>
			</tr>
		';
}
$list .= '</table>';
#	$list = '<table><tr><td colspan=20 >This feature is currently not available (database upgrade). Sorry. Back soon</td></tr></table>';
$wt->assign('latestglobal', $list);
unset($list);
//Make topten sulinfo table
$list = '';
$i = 0;
$listsum = 0;
$latestother = '';
foreach ($cnt->wikis as $sulwiki => $row) {
    $latest = @$cnt->mLatestEditsGlobal["latest"][$sulwiki];
    $diff = $wt->datediff(DateTime::createFromFormat('YmdHis', $latest));
    $diffspan = "<span style=\"color:{$diff->diffcolor}\" ><small>{$diff->difftxt}</small></span>";
    $trmarker = "";
    if ($sulwiki == $wi->database) {
        $trmarker = '►';
    }
    $blockmarker = "";
    $blocktext = '';
    if ($row["blocked"]) {
        $blockmarker = 'red';
        $blocktext = 'The user is currently blocked on this wiki';
    }
    if ($row["editcount"] && $i <= 10) {
        $list .= '
				<tr>
				<td>' . $trmarker . ' <span title="' . $blocktext . '" style="color:' . $blockmarker . '" >' . $sulwiki . '</span></td>
예제 #2
0
파일: config.php 프로젝트: Krinkle/xtools
 //api
 foreach (array_keys($wikiList) as $wiki) {
     $domain = $wt->metap[$wiki]["domain"];
     $apibase = "http://{$domain}/w/api.php?";
     $pages = array_values($wikiList[$wiki]);
     $data = array('action' => 'query', 'format' => 'json', 'prop' => 'info|revisions', 'inprop' => 'watched|watchers|notificationtimestamp|url', 'indexpageids' => '', 'converttitles' => '', 'titles' => implode('|', $pages));
     $query = $apibase . http_build_query($data);
     #print_r($apibase);
     #print_r($data);
     $res = json_decode($wt->gethttp($query))->query->pages;
     foreach ($res as $pageid => $row) {
         $hash = crc32($wiki . $row->title);
         foreach ($pageList as $i => $entry) {
             if ($hash == $entry["hash"]) {
                 try {
                     $diff = $wt->datediff(new DateTime($row->revisions[0]->timestamp));
                     $lastrev = $wt->dateFmt($row->revisions[0]->timestamp);
                     $err = false;
                 } catch (Exception $e) {
                     $err = true;
                 }
                 if ($err) {
                     $diff = $wt->datediff(null);
                     $lastrev = null;
                 }
                 $pageList[$i]["pageid"] = $pageid;
                 $pageList[$i]["ns"] = $row->ns;
                 $pageList[$i]["lastrev"] = $lastrev;
                 $pageList[$i]["datediff"] = "<span style=\"color:{$diff->diffcolor} \" >{$diff->difftxt}</span>";
                 $pageList[$i]["lastrevid"] = $row->lastrevid;
                 $pageList[$i]["lastuser"] = $row->revisions[0]->user;
예제 #3
0
파일: api.php 프로젝트: Krinkle/xtools
 }
 $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;';
         $html = '<a style="' . $style . '" class="mw-echo-notifications-badge" href="//tools.wmflabs.org/xtools/echo/" >1</a>';
     } else {
         $html = $outerspan . $messageLink . implode(", ", array_filter($data)) . $xtoolsPhLink . "</span>";
     }
     $res = array('sessid' => session_id(), 'html' => $html, 'cfg' => json_encode($conf));
     #		sleep(5);
     header("Access-Control-Allow-Origin: *");