Пример #1
0
    $diff_nowp = array_diff($r1, $r2);
    if (count($diff_nowd) != 0) {
        $page->addInline('h3', 'Lokal als ' . $par['mode'] . ' ausgezeichnet, aber nicht auf Wikidata');
        $page->openBlock('ul');
        foreach ($diff_nowd as $v1) {
            if ($par['mode'] == 'portal') {
                $page->addInline('li', Hgz::buildWikilink('de', 'wikipedia', 'Portal:' . $v1, 'Portal:' . str_replace('_', ' ', $v1)));
            } else {
                $page->addInline('li', Hgz::buildWikilink('de', 'wikipedia', $v1, str_replace('_', ' ', $v1)));
            }
        }
        $page->closeBlock();
    }
    if (count($diff_nowp) != 0) {
        $page->addInline('h3', 'Auf Wikidata als ' . $par['mode'] . '  ausgezeichnet, aber nicht lokal');
        $page->openBlock('ul');
        foreach ($diff_nowp as $v1) {
            if ($par['mode'] == 'portal') {
                $page->addInline('li', Hgz::buildWikilink('de', 'wikipedia', 'Portal:' . $v1, 'Portal:' . str_replace('_', ' ', $v1)));
            } else {
                $page->addInline('li', Hgz::buildWikilink('de', 'wikipedia', $v1, str_replace('_', ' ', $v1)));
            }
        }
        $page->closeBlock();
    }
    $q1->close();
    $q2->close();
    $page->closeBlock();
}
$db->close();
$page->output();
Пример #2
0
$optionForm->addButton('submit', 'View useless defaultsorts');
$optionForm->addHTML('</td></tr>');
$optionForm->addHTML('</table>');
$optionForm->output();
$page->closeBlock();
if ($rq->allRequiredDefined() == true) {
    $page->openBlock('div', 'iw-content');
    $page->addInline('h2', 'Results');
    $db->replicaConnect(Database::getName($par['lang'], $par['project']));
    $t1 = 'SELECT page_title, page_namespace, pp_value FROM page, page_props';
    $t1 .= ' WHERE pp_propname = \'defaultsort\' AND pp_page = page_id AND REPLACE(page_title, \'_\', \' \') = pp_value';
    $t1 .= ' ORDER BY page_namespace, page_title;';
    $q1 = $db->query($t1);
    if ($q1->num_rows === 0) {
        $page->addInline('p', 'there were no results for this query', 'iw-info');
    } else {
        $page->openBlock('table', 'iw-table');
        $page->addInline('tr', '<th>Page</th><th>Defaultsort</th>');
        while ($l1 = $q1->fetch_assoc()) {
            $page->openBlock('tr');
            $page->addInline('td', Hgz::buildWikilink($par['lang'], $par['project'], Database::getNsNameFromNr($l1['page_namespace']) . $l1['page_title'], Database::getNsNameFromNr($l1['page_namespace'], false) . str_replace('_', ' ', $l1['page_title'])));
            $page->addInline('td', $l1['pp_value']);
            $page->closeBlock();
        }
        $page->closeBlock();
    }
    $q1->close();
    $page->closeBlock();
}
$db->close();
$page->output();
Пример #3
0
    if ($par['sort'] == 'name') {
        $t1 .= 'ORDER BY page.page_title;';
    } elseif ($par['sort'] == 'length') {
        $t1 .= 'ORDER BY page.page_len DESC;';
    } elseif ($par['sort'] == 'entries') {
        $t1 .= 'ORDER BY cl DESC;';
    }
    $q1 = $db->query($t1);
    if ($q1->num_rows === 0) {
        $page->addInline('p', 'there were no results for this query', 'iw-info');
    } else {
        $page->openBlock('table', 'iw-table');
        $page->openBlock('tr');
        $page->addInline('th', '<a href="index.php?lang=' . $par['lang'] . '&project=' . $par['project'] . '&sort=name">Name</a>');
        $page->addInline('th', '<a href="index.php?lang=' . $par['lang'] . '&project=' . $par['project'] . '&sort=entries">Entries</a>');
        $page->addInline('th', '<a href="index.php?lang=' . $par['lang'] . '&project=' . $par['project'] . '&sort=length">Bytes</a>');
        $page->closeBlock();
        while ($l1 = $q1->fetch_assoc()) {
            $page->openBlock('tr');
            $page->addInline('td', Hgz::buildWikilink($par['lang'], $par['project'], 'Category:' . $l1['page_title'], str_replace('_', ' ', $l1['page_title']), 'redirect=no'));
            $page->addInline('td', $l1['cl']);
            $page->addInline('td', $l1['page_len']);
            $page->closeBlock();
        }
        $page->closeBlock();
    }
    $q1->close();
    $page->closeBlock();
}
$page->output();
$db->close();
Пример #4
0
$optionForm->output();
$page->closeBlock();
if ($rq->allRequiredDefined() == true) {
    $page->openBlock('div', 'iw-content');
    $page->addInline('h2', 'Results');
    $db->replicaConnect(Database::getName($par['lang'], $par['project']));
    $par['page'] = str_replace(' ', '_', $par['page']);
    $par['page'] = $db->real_escape_string($par['page']);
    $t1 = 'SELECT revision_userindex.rev_timestamp, revision_userindex.rev_user_text, revision_userindex.rev_comment, revision_userindex.rev_id FROM revision_userindex, page WHERE page.page_title = \'' . $par['page'] . '\' ';
    $t1 .= 'AND page.page_namespace = 0 AND revision_userindex.rev_page = page.page_id ';
    $t1 .= 'ORDER BY revision_userindex.rev_timestamp DESC;';
    $q1 = $db->query($t1);
    if ($q1->num_rows === 0) {
        $page->addInline('p', 'there were no results for this query', 'iw-info');
    } else {
        $page->addInline('p', 'found ' . $q1->num_rows . ' revisions for article ' . Hgz::buildWikilink($par['lang'], $par['project'], $par['page'], str_replace('_', ' ', $par['page'])) . '(<a href="https://' . $par['lang'] . '.' . $par['project'] . '.org/w/index.php?title=' . $par['page'] . '&action=history">History</a>).');
        $page->openBlock('div', 'iw-code');
        while ($l1 = $q1->fetch_assoc()) {
            $datetime = DateTime::createFromFormat('YmdHis', $l1['rev_timestamp']);
            $dateform = $datetime->format('Y-m-d H:i');
            $dateraw = $datetime->format('Ymd');
            if (isset($par['since']) && $par['since'] != '0000-00-00') {
                $timestamp = str_replace('-', '', $par['since']);
                if ($dateraw < $timestamp) {
                    continue;
                }
            }
            if (isset($par['until']) && $par['until'] != '0000-00-00') {
                $timestamp = str_replace('-', '', $par['until']);
                if ($dateraw > $timestamp) {
                    continue;
Пример #5
0
$page = new HtmlPage('hgztools');
$page->openBlock('div', 'iw-content');
$page->addInline('h2', 'Tools for all Wikimedia projects');
$page->openBlock('ul');
$page->addInline('li', '<a href="botstatistics/">Bot statistics</a>');
$page->addInline('li', '<a href="categoryredirects/">Category redirects</a>');
$page->addInline('li', '<a href="contributors/">Contributors tool</a>');
$page->addInline('li', '<a href="pagepropmaintenance/">Page prop maintenance</a>');
$page->addInline('li', '<a href="uselessdefaultsorts/">Useless defaultsorts</a>');
$page->addInline('li', '<a href="uselessprotections/">Useless protections</a>');
$page->closeBlock();
$page->addInline('h2', 'Tools for German Wikipedia');
$page->openBlock('ul');
$page->addInline('li', '<a href="wikidata-badges/">Wikidata-Auszeichnungs-Abgleich</a>');
$page->closeBlock();
$page->addInline('p', 'Contact: ' . Hgz::buildWikilink('de', 'wikipedia', 'User talk:Hgzh', 'hgzh @ de.wikipedia') . ', Source: <a href="https://github.com/hgzh">hgzh @ github.com</a>');
$page->closeBlock();
$page->openBlock('div', 'iw-content');
$page->addInline('h2', 'Change log');
$page->addInline('h3', '2015-09-29');
$page->openBlock('ul');
$page->addInline('li', 'Added Useless defaultsort tool');
$page->addInline('li', 'Added Page prop maintenance');
$page->addInline('li', 'Added Wikidata badges maintenance tool for German Wikipedia');
$page->closeBlock();
$page->addInline('h3', '2015-09-28');
$page->openBlock('ul');
$page->addInline('li', 'Useless protections: sort results by namespace and page title');
$page->closeBlock();
$page->addInline('h3', '2015-09-27');
$page->openBlock('ul');
Пример #6
0
 $page->closeBlock();
 $datenow = new DateTime('now');
 $counter = 1;
 while ($l1 = $q1->fetch_assoc()) {
     if (isset($l1['user_registration']) && $l1['user_registration'] != '') {
         $datereg = DateTime::createFromFormat('YmdHis', $l1['user_registration']);
         $dateitv = $datereg->diff($datenow);
         $dateday = $dateitv->format('%a');
         $epd = $l1['user_editcount'] / $dateday;
         $datefound = true;
     } else {
         $datefound = false;
     }
     $page->openBlock('tr');
     $page->addInline('td', $counter++);
     $page->addInline('td', Hgz::buildWikilink($par['lang'], $par['project'], 'User:'******'user_name'], str_replace('_', ' ', $l1['user_name'])) . ' ( ' . Hgz::buildWikilink($par['lang'], $par['project'], 'Special:Contributions/' . $l1['user_name'], 'c') . ' | ' . Hgz::buildWikilink($par['lang'], $par['project'], 'Special:Log/' . $l1['user_name'], 'l') . ' )');
     if ($datefound == true) {
         $page->addInline('td', $datereg->format('j M Y'));
     } else {
         $page->addInline('td', '');
     }
     $page->addInline('td', number_format($l1['user_editcount'], 0, '', ' '));
     if ($datefound == true) {
         $page->addInline('td', number_format($epd, 2, ',', ' '));
     } else {
         $page->addInline('td', '');
     }
     $page->closeBlock();
 }
 $page->closeBlock();
 $q1->close();