コード例 #1
0
 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->addWikiMsg('confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $self = SpecialPage::getTitleFor('Confirmemail');
         $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
         $form .= wfHidden('token', $wgUser->editToken());
         $form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
         $form .= wfCloseElement('form');
         $wgOut->addHtml($form);
     }
 }
コード例 #2
0
 /**
  * @param WebRequest $request
  */
 function show($request)
 {
     global $wgOut, $wgUser;
     $first = $this->revisions[0];
     $wgOut->addWikiText(wfMsg('revdelete-selected', $this->page->getPrefixedText()));
     $wgOut->addHtml("<ul>");
     foreach ($this->revisions as $revid) {
         $rev = Revision::newFromTitle($this->page, $revid);
         $wgOut->addHtml($this->historyLine($rev));
         $bitfields[] = $rev->mDeleted;
         // FIXME
     }
     $wgOut->addHtml("</ul>");
     $wgOut->addWikiText(wfMsg('revdelete-text'));
     $items = array(wfInputLabel(wfMsg('revdelete-log'), 'wpReason', 'wpReason', 60), wfSubmitButton(wfMsg('revdelete-submit')));
     $hidden = array(wfHidden('wpEditToken', $wgUser->editToken()), wfHidden('target', $this->page->getPrefixedText()));
     foreach ($this->revisions as $revid) {
         $hidden[] = wfHidden('oldid[]', $revid);
     }
     $special = Title::makeTitle(NS_SPECIAL, 'Revisiondelete');
     $wgOut->addHtml(wfElement('form', array('method' => 'post', 'action' => $special->getLocalUrl('action=submit'))));
     $wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('revdelete-legend') . '</legend>');
     foreach ($this->checks as $item) {
         list($message, $name, $field) = $item;
         $wgOut->addHtml('<div>' . wfCheckLabel(wfMsg($message), $name, $name, $rev->isDeleted($field)) . '</div>');
     }
     $wgOut->addHtml('</fieldset>');
     foreach ($items as $item) {
         $wgOut->addHtml('<p>' . $item . '</p>');
     }
     foreach ($hidden as $item) {
         $wgOut->addHtml($item);
     }
     $wgOut->addHtml('</form>');
 }
コード例 #3
0
 function showForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     $self = SpecialPage::getTitleFor('Resetpass');
     $form = '<div id="userloginForm">' . wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl())) . '<h2>' . wfMsgHtml('resetpass_header') . '</h2>' . '<div id="userloginprompt">' . wfMsgExt('resetpass_text', array('parse')) . '</div>' . '<table>' . wfHidden('token', $wgUser->editToken()) . wfHidden('wpName', $this->mName) . wfHidden('wpPassword', $this->mTemporaryPassword) . wfHidden('returnto', $wgRequest->getVal('returnto')) . $this->pretty(array(array('wpName', 'username', 'text', $this->mName), array('wpNewPassword', 'newpassword', 'password', ''), array('wpRetype', 'yourpasswordagain', 'password', ''))) . '<tr>' . '<td></td>' . '<td>' . Xml::checkLabel(wfMsg('remembermypassword'), 'wpRemember', 'wpRemember', $wgRequest->getCheck('wpRemember')) . '</td>' . '</tr>' . '<tr>' . '<td></td>' . '<td>' . wfSubmitButton(wfMsgHtml('resetpass_submit')) . '</td>' . '</tr>' . '</table>' . wfCloseElement('form') . '</div>';
     $wgOut->addHtml($form);
 }
コード例 #4
0
 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         $message = WikiError::isError($ok) ? 'confirmemail_sendfailed' : 'confirmemail_sent';
         $wgOut->addWikiText(wfMsg($message));
     } else {
         if ($wgUser->isEmailConfirmed()) {
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiText(wfMsg('emailauthenticated', $time));
         }
         $wgOut->addWikiText(wfMsg('confirmemail_text'));
         $self = Title::makeTitle(NS_SPECIAL, 'Confirmemail');
         $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
         $form .= wfHidden('token', $wgUser->editToken());
         $form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
         $form .= wfCloseElement('form');
         $wgOut->addHtml($form);
     }
 }
コード例 #5
0
ファイル: SpecialImport.php プロジェクト: k-hasan-19/wiki
/**
 * Constructor
 */
function wfSpecialImport($page = '')
{
    global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources;
    global $wgImportTargetNamespace;
    $interwiki = false;
    $namespace = $wgImportTargetNamespace;
    $frompage = '';
    $history = true;
    if ($wgRequest->wasPosted() && $wgRequest->getVal('action') == 'submit') {
        $isUpload = false;
        $namespace = $wgRequest->getIntOrNull('namespace');
        switch ($wgRequest->getVal("source")) {
            case "upload":
                $isUpload = true;
                if ($wgUser->isAllowed('importupload')) {
                    $source = ImportStreamSource::newFromUpload("xmlimport");
                } else {
                    return $wgOut->permissionRequired('importupload');
                }
                break;
            case "interwiki":
                $interwiki = $wgRequest->getVal('interwiki');
                $history = $wgRequest->getCheck('interwikiHistory');
                $frompage = $wgRequest->getText("frompage");
                $source = ImportStreamSource::newFromInterwiki($interwiki, $frompage, $history);
                break;
            default:
                $source = new WikiErrorMsg("importunknownsource");
        }
        if (WikiError::isError($source)) {
            $wgOut->addWikiText(wfEscapeWikiText($source->getMessage()));
        } else {
            $wgOut->addWikiText(wfMsg("importstart"));
            $importer = new WikiImporter($source);
            if (!is_null($namespace)) {
                $importer->setTargetNamespace($namespace);
            }
            $reporter = new ImportReporter($importer, $isUpload, $interwiki);
            $reporter->open();
            $result = $importer->doImport();
            $reporter->close();
            if (WikiError::isError($result)) {
                $wgOut->addWikiText(wfMsg("importfailed", wfEscapeWikiText($result->getMessage())));
            } else {
                # Success!
                $wgOut->addWikiText(wfMsg("importsuccess"));
            }
        }
    }
    $action = $wgTitle->escapeLocalUrl('action=submit');
    if ($wgUser->isAllowed('importupload')) {
        $wgOut->addWikiText(wfMsg("importtext"));
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('upload') . "</legend>\n\t<form enctype='multipart/form-data' method='post' action=\"{$action}\">\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='upload' />\n\t\t<input type='hidden' name='MAX_FILE_SIZE' value='2000000' />\n\t\t<input type='file' name='xmlimport' value='' size='30' />\n\t\t<input type='submit' value=\"" . wfMsgHtml("uploadbtn") . "\" />\n\t</form>\n</fieldset>\n");
    } else {
        if (empty($wgImportSources)) {
            $wgOut->addWikiText(wfMsg('importnosources'));
        }
    }
    if (!empty($wgImportSources)) {
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('importinterwiki') . "</legend>\n\t<form method='post' action=\"{$action}\">" . $wgOut->parse(wfMsg('import-interwiki-text')) . "\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='interwiki' />\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<select name='interwiki'>");
        foreach ($wgImportSources as $prefix) {
            $iw = htmlspecialchars($prefix);
            $selected = $interwiki === $prefix ? ' selected="selected"' : '';
            $wgOut->addHTML("<option value=\"{$iw}\"{$selected}>{$iw}</option>\n");
        }
        $wgOut->addHTML("\n\t\t\t\t\t</select>\n\t\t\t\t</td>\n\t\t\t\t<td>" . wfInput('frompage', 50, $frompage) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . wfCheckLabel(wfMsg('import-interwiki-history'), 'interwikiHistory', 'interwikiHistory', $history) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t" . wfMsgHtml('import-interwiki-namespace') . " " . HTMLnamespaceselector($namespace, '') . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . wfSubmitButton(wfMsg('import-interwiki-submit')) . "</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>\n</fieldset>\n");
    }
}
コード例 #6
0
 function showHistory()
 {
     global $wgLang, $wgUser, $wgOut;
     $sk = $wgUser->getSkin();
     if ($this->mAllowed) {
         $wgOut->setPagetitle(wfMsg("undeletepage"));
     } else {
         $wgOut->setPagetitle(wfMsg('viewdeletedpage'));
     }
     $archive = new PageArchive($this->mTargetObj);
     $text = $archive->getLastRevisionText();
     /*
     if( is_null( $text ) ) {
     	$wgOut->addWikiText( wfMsg( "nohistory" ) );
     	return;
     }
     */
     if ($this->mAllowed) {
         $wgOut->addWikiText(wfMsg("undeletehistory"));
     } else {
         $wgOut->addWikiText(wfMsg("undeletehistorynoadmin"));
     }
     # List all stored revisions
     $revisions = $archive->listRevisions();
     $files = $archive->listFiles();
     $haveRevisions = $revisions && $revisions->numRows() > 0;
     $haveFiles = $files && $files->numRows() > 0;
     # Batch existence check on user and talk pages
     if ($haveRevisions) {
         $batch = new LinkBatch();
         while ($row = $revisions->fetchObject()) {
             $batch->addObj(Title::makeTitleSafe(NS_USER, $row->ar_user_text));
             $batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->ar_user_text));
         }
         $batch->execute();
         $revisions->seek(0);
     }
     if ($haveFiles) {
         $batch = new LinkBatch();
         while ($row = $files->fetchObject()) {
             $batch->addObj(Title::makeTitleSafe(NS_USER, $row->fa_user_text));
             $batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->fa_user_text));
         }
         $batch->execute();
         $files->seek(0);
     }
     if ($this->mAllowed) {
         $titleObj = Title::makeTitle(NS_SPECIAL, "Undelete");
         $action = $titleObj->getLocalURL("action=submit");
         # Start the form here
         $top = wfOpenElement('form', array('method' => 'post', 'action' => $action, 'id' => 'undelete'));
         $wgOut->addHtml($top);
     }
     # Show relevant lines from the deletion log:
     $wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
     $logViewer = new LogViewer(new LogReader(new FauxRequest(array('page' => $this->mTargetObj->getPrefixedText(), 'type' => 'delete'))));
     $logViewer->showList($wgOut);
     if ($this->mAllowed && ($haveRevisions || $haveFiles)) {
         # Format the user-visible controls (comment field, submission button)
         # in a nice little table
         $table = '<fieldset><table><tr>';
         $table .= '<td colspan="2">' . wfMsgWikiHtml('undeleteextrahelp') . '</td></tr><tr>';
         $table .= '<td align="right"><strong>' . wfMsgHtml('undeletecomment') . '</strong></td>';
         $table .= '<td>' . wfInput('wpComment', 50, $this->mComment) . '</td>';
         $table .= '</tr><tr><td>&nbsp;</td><td>';
         $table .= wfSubmitButton(wfMsg('undeletebtn'), array('name' => 'restore'));
         $table .= wfElement('input', array('type' => 'reset', 'value' => wfMsg('undeletereset')));
         $table .= '</td></tr></table></fieldset>';
         $wgOut->addHtml($table);
     }
     $wgOut->addHTML("<h2>" . htmlspecialchars(wfMsg("history")) . "</h2>\n");
     if ($haveRevisions) {
         # The page's stored (deleted) history:
         $wgOut->addHTML("<ul>");
         $target = urlencode($this->mTarget);
         while ($row = $revisions->fetchObject()) {
             $ts = wfTimestamp(TS_MW, $row->ar_timestamp);
             if ($this->mAllowed) {
                 $checkBox = wfCheck("ts{$ts}");
                 $pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}&timestamp={$ts}");
             } else {
                 $checkBox = '';
                 $pageLink = $wgLang->timeanddate($ts, true);
             }
             $userLink = $sk->userLink($row->ar_user, $row->ar_user_text) . $sk->userToolLinks($row->ar_user, $row->ar_user_text);
             $comment = $sk->commentBlock($row->ar_comment);
             $wgOut->addHTML("<li>{$checkBox} {$pageLink} . . {$userLink} {$comment}</li>\n");
         }
         $revisions->free();
         $wgOut->addHTML("</ul>");
     } else {
         $wgOut->addWikiText(wfMsg("nohistory"));
     }
     if ($haveFiles) {
         $wgOut->addHtml("<h2>" . wfMsgHtml('imghistory') . "</h2>\n");
         $wgOut->addHtml("<ul>");
         while ($row = $files->fetchObject()) {
             $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
             if ($this->mAllowed && $row->fa_storage_key) {
                 $checkBox = wfCheck("fileid" . $row->fa_id);
                 $key = urlencode($row->fa_storage_key);
                 $target = urlencode($this->mTarget);
                 $pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}&file={$key}");
             } else {
                 $checkBox = '';
                 $pageLink = $wgLang->timeanddate($ts, true);
             }
             $userLink = $sk->userLink($row->fa_user, $row->fa_user_text) . $sk->userToolLinks($row->fa_user, $row->fa_user_text);
             $data = wfMsgHtml('widthheight', $wgLang->formatNum($row->fa_width), $wgLang->formatNum($row->fa_height)) . ' (' . wfMsgHtml('nbytes', $wgLang->formatNum($row->fa_size)) . ')';
             $comment = $sk->commentBlock($row->fa_description);
             $wgOut->addHTML("<li>{$checkBox} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n");
         }
         $files->free();
         $wgOut->addHTML("</ul>");
     }
     if ($this->mAllowed) {
         # Slip in the hidden controls here
         $misc = wfHidden('target', $this->mTarget);
         $misc .= wfHidden('wpEditToken', $wgUser->editToken());
         $wgOut->addHtml($misc . '</form>');
     }
     return true;
 }
コード例 #7
0
ファイル: SpecialExport.php プロジェクト: k-hasan-19/wiki
/**
 *
 */
function wfSpecialExport($page = '')
{
    global $wgOut, $wgRequest, $wgExportAllowListContributors;
    global $wgExportAllowHistory, $wgExportMaxHistory;
    $curonly = true;
    if ($wgRequest->getVal('action') == 'submit') {
        $page = $wgRequest->getText('pages');
        $curonly = $wgRequest->getCheck('curonly');
    }
    if ($wgRequest->getCheck('history')) {
        $curonly = false;
    }
    if (!$wgExportAllowHistory) {
        // Override
        $curonly = true;
    }
    $list_authors = $wgRequest->getCheck('listauthors');
    if (!$curonly || !$wgExportAllowListContributors) {
        $list_authors = false;
    }
    if ($page != '') {
        $wgOut->disable();
        // Cancel output buffering and gzipping if set
        // This should provide safer streaming for pages with history
        while ($status = ob_get_status()) {
            ob_end_clean();
            if ($status['name'] == 'ob_gzhandler') {
                header('Content-Encoding:');
            }
        }
        header("Content-type: application/xml; charset=utf-8");
        $pages = explode("\n", $page);
        $db =& wfGetDB(DB_SLAVE);
        $history = $curonly ? MW_EXPORT_CURRENT : MW_EXPORT_FULL;
        $exporter = new WikiExporter($db, $history);
        $exporter->list_authors = $list_authors;
        $exporter->openStream();
        foreach ($pages as $page) {
            if ($wgExportMaxHistory && !$curonly) {
                $title = Title::newFromText($page);
                if ($title) {
                    $count = Revision::countByTitle($db, $title);
                    if ($count > $wgExportMaxHistory) {
                        wfDebug(__FUNCTION__ . ": Skipped {$page}, {$count} revisions too big\n");
                        continue;
                    }
                }
            }
            $exporter->pageByName($page);
        }
        $exporter->closeStream();
        return;
    }
    $wgOut->addWikiText(wfMsg("exporttext"));
    $titleObj = Title::makeTitle(NS_SPECIAL, "Export");
    $form = wfOpenElement('form', array('method' => 'post', 'action' => $titleObj->getLocalUrl()));
    $form .= wfOpenElement('textarea', array('name' => 'pages', 'cols' => 40, 'rows' => 10)) . '</textarea><br />';
    if ($wgExportAllowHistory) {
        $form .= wfCheck('curonly', true, array('value' => 'true', 'id' => 'curonly'));
        $form .= wfLabel(wfMsg('exportcuronly'), 'curonly') . '<br />';
    } else {
        $wgOut->addWikiText(wfMsg('exportnohistory'));
    }
    $form .= wfHidden('action', 'submit');
    $form .= wfSubmitButton(wfMsg('export-submit')) . '</form>';
    $wgOut->addHtml($form);
}
コード例 #8
0
 /**
  * Show a form for filtering namespace and username
  *
  * @return string
  */
 function getPageHeader()
 {
     $self = Title::makeTitle(NS_SPECIAL, $this->getName());
     $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
     $form .= '<table><tr><td align="right">' . wfMsgHtml('namespace') . '</td>';
     $form .= '<td>' . HtmlNamespaceSelector($this->namespace) . '</td><tr>';
     $form .= '<tr><td align="right">' . wfMsgHtml('newpages-username') . '</td>';
     $form .= '<td>' . wfInput('username', 30, $this->username) . '</td></tr>';
     $form .= '<tr><td></td><td>' . wfSubmitButton(wfMsg('allpagessubmit')) . '</td></tr></table>';
     $form .= wfHidden('offset', $this->offset) . wfHidden('limit', $this->limit) . '</form>';
     return $form;
 }
コード例 #9
0
ファイル: SpecialExport.php プロジェクト: puring0815/OpenKore
/**
 *
 */
function wfSpecialExport($page = '')
{
    global $wgOut, $wgRequest, $wgExportAllowListContributors;
    global $wgExportAllowHistory, $wgExportMaxHistory;
    $curonly = true;
    $fullHistory = array('dir' => 'asc', 'offset' => false, 'limit' => $wgExportMaxHistory);
    if ($wgRequest->wasPosted()) {
        $page = $wgRequest->getText('pages');
        $curonly = $wgRequest->getCheck('curonly');
        $rawOffset = $wgRequest->getVal('offset');
        if ($rawOffset) {
            $offset = wfTimestamp(TS_MW, $rawOffset);
        } else {
            $offset = null;
        }
        $limit = $wgRequest->getInt('limit');
        $dir = $wgRequest->getVal('dir');
        $history = array('dir' => 'asc', 'offset' => false, 'limit' => $wgExportMaxHistory);
        $historyCheck = $wgRequest->getCheck('history');
        if ($curonly) {
            $history = WikiExporter::CURRENT;
        } elseif (!$historyCheck) {
            if ($limit > 0 && $limit < $wgExportMaxHistory) {
                $history['limit'] = $limit;
            }
            if (!is_null($offset)) {
                $history['offset'] = $offset;
            }
            if (strtolower($dir) == 'desc') {
                $history['dir'] = 'desc';
            }
        }
    } else {
        // Default to current-only for GET requests
        $page = $wgRequest->getText('pages', $page);
        $historyCheck = $wgRequest->getCheck('history');
        if ($historyCheck) {
            $history = WikiExporter::FULL;
        } else {
            $history = WikiExporter::CURRENT;
        }
    }
    if (!$wgExportAllowHistory) {
        // Override
        $history = WikiExporter::CURRENT;
    }
    $list_authors = $wgRequest->getCheck('listauthors');
    if (!$curonly || !$wgExportAllowListContributors) {
        $list_authors = false;
    }
    if ($page != '') {
        $wgOut->disable();
        // Cancel output buffering and gzipping if set
        // This should provide safer streaming for pages with history
        while ($status = ob_get_status()) {
            ob_end_clean();
            if ($status['name'] == 'ob_gzhandler') {
                header('Content-Encoding:');
            }
        }
        header("Content-type: application/xml; charset=utf-8");
        $pages = explode("\n", $page);
        $db =& wfGetDB(DB_SLAVE);
        $exporter = new WikiExporter($db, $history);
        $exporter->list_authors = $list_authors;
        $exporter->openStream();
        foreach ($pages as $page) {
            /*
            			if( $wgExportMaxHistory && !$curonly ) {
            				$title = Title::newFromText( $page );
            				if( $title ) {
            					$count = Revision::countByTitle( $db, $title );
            					if( $count > $wgExportMaxHistory ) {
            						wfDebug( __FUNCTION__ .
            							": Skipped $page, $count revisions too big\n" );
            						continue;
            					}
            				}
            			}*/
            $exporter->pageByName($page);
        }
        $exporter->closeStream();
        return;
    }
    $wgOut->addWikiText(wfMsg("exporttext"));
    $titleObj = Title::makeTitle(NS_SPECIAL, "Export");
    $form = wfOpenElement('form', array('method' => 'post', 'action' => $titleObj->getLocalUrl()));
    $form .= wfOpenElement('textarea', array('name' => 'pages', 'cols' => 40, 'rows' => 10)) . '</textarea><br />';
    if ($wgExportAllowHistory) {
        $form .= wfCheck('curonly', true, array('value' => 'true', 'id' => 'curonly'));
        $form .= wfLabel(wfMsg('exportcuronly'), 'curonly') . '<br />';
    } else {
        $wgOut->addWikiText(wfMsg('exportnohistory'));
    }
    $form .= wfHidden('action', 'submit');
    $form .= wfSubmitButton(wfMsg('export-submit')) . '</form>';
    $wgOut->addHtml($form);
}
コード例 #10
0
 function makeNamespaceForm()
 {
     $self = Title::makeTitle(NS_SPECIAL, $this->getName());
     $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
     $form .= wfLabel(wfMsg('newestpages-namespace'), 'namespace') . '&nbsp;';
     $form .= htmlNamespaceSelector($this->namespace, 'all');
     $form .= wfHidden('limit', $this->limit);
     $form .= wfHidden('redirects', $this->redirects);
     $form .= wfSubmitButton(wfMsg('newestpages-submit')) . '</form>';
     return $form;
 }
コード例 #11
0
 function execute($par)
 {
     global $wgRequest, $wgOut, $wgTitle, $wgLocalDatabases, $wgUser;
     global $wgConf, $wgCanonicalNamespaceNames, $wgLang;
     $this->setHeaders();
     # Check permissions
     if (!$wgUser->isAllowed('lookupcontribs')) {
         $wgOut->permissionRequired('lookupcontribs');
         return;
     }
     $user = $wgRequest->getText('user');
     #		$userName =  $user->getName();
     # Show form
     $self = Title::makeTitle(NS_SPECIAL, 'LookupContribs');
     $form = '<span>' . wfMsgHtml('lookupcontribs-summary') . '</span>';
     $form .= wfOpenElement('form', array('method' => 'get', 'action' => $self->getLocalUrl()));
     //original was method=post
     $form .= '<table><tr><td align="right">' . wfMsgHtml('lookupcontribs-user') . '</td>';
     $form .= '<td>' . wfInput('user', 50, $user) . '</td></tr>';
     $form .= '<tr><td></td><td>' . wfSubmitButton(wfMsg('go')) . '</td></tr></table></form>';
     $wgOut->addHtml($form);
     if ($user) {
         $dbr = wfGetDB(DB_SLAVE);
         $s = '';
         foreach ($wgLocalDatabases as $db) {
             $sql = "SELECT rc_namespace,rc_title,rc_timestamp,rc_user_text,rc_last_oldid FROM {$db}.recentchanges WHERE rc_user_text='" . $dbr->strencode($user) . "' AND rc_this_oldid=0";
             //TODO: use page & revision tables, alá Special:Contributions
             $res = $dbr->query($sql, "findspam.php");
             //this seems to be a wikimedia-specific hack that needs a total rewrite
             $arr = explode('.', strtolower($_SERVER['SERVER_NAME']));
             $subdomain = $arr[0];
             //list( $site, $lang ) = $wgConf->siteFromDB( $db );
             //if ( $lang == 'en' ) {
             //	$baseUrl = "http://internal.jackphoenix.com"; //ugly!
             //} else {
             $baseUrl = "http://{$subdomain}.jackphoenix.com";
             //}
             if ($dbr->numRows($res)) {
                 $s .= "\n{$db}\n";
                 while ($row = $dbr->fetchObject($res)) {
                     if ($row->rc_namespace == 0) {
                         $title = $row->rc_title;
                     } else {
                         $title = $wgCanonicalNamespaceNames[$row->rc_namespace] . ':' . $row->rc_title;
                     }
                     $encTitle = urlencode($title);
                     $url = "{$baseUrl}/wiki/{$encTitle}";
                     $user = urlencode($row->rc_user_text);
                     $rollbackText = wfMsg('rollback');
                     $diffText = wfMsg('diff');
                     $rollbackUrl = "{$baseUrl}/w/wiki.phtml?title={$encTitle}&action=rollback&from={$user}";
                     $diffUrl = "{$baseUrl}/w/wiki.phtml?title={$encTitle}&diff=0&oldid=0";
                     if ($row->rc_last_oldid) {
                         $lastLink = "[{$baseUrl}/w/wiki.phtml?title={$encTitle}&oldid={$row->rc_last_oldid}&action=edit last]";
                     }
                     $date = $wgLang->timeanddate($row->rc_timestamp);
                     $s .= "* {$date} [{$url} {$title}] ([{$rollbackUrl} {$rollbackText}] | [{$diffUrl} {$diffText}])\n";
                     $s .= "* {$date} [{$url} {$title}] ({$lastLink} | [{$diffUrl} {$diffText}])\n";
                 }
             }
         }
         if ($s == '') {
             $s = wfMsg('lookupcontribs-notextfound');
         }
         /* TODO: fixme 
         			if (!$userName->exists) {
         			wfMsg('nosuchusershort');
         			}*/
         $wgOut->addWikiText($s . "<br />");
     }
 }