Beispiel #1
1
/**
 * Called to display the Special:ReviewMerge page
 *
 * @param unknown_type $par
 * @param unknown_type $specialPage
 */
function wfSpecialReviewMerge($par = NULL, $specialPage)
{
    global $wgOut, $wgScriptPath, $wgUser, $wrSidebarHtml;
    $reviewForm = new ReviewForm();
    // read query parameters into variables
    $unmerge = '';
    if (!$reviewForm->readQueryParms($par)) {
        $wgOut->setPageTitle('Review merge');
        $results = '<p>You must click on a "review" link on Recent Changes or a page history in order to review the merge.</p>';
    } else {
        if ($reviewForm->isMarkPatrolled()) {
            $wgOut->setPagetitle(wfMsg('markedaspatrolled'));
            $results = $reviewForm->markPatrolled();
        } else {
            if ($reviewForm->isUnmerge()) {
                if (!$wgUser->isLoggedIn()) {
                    if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
                        User::SetupSession();
                    }
                    $title = Title::makeTitle(NS_SPECIAL, 'ReviewMerge/' . $par);
                    $requestData = array();
                    if ($title) {
                        $requestData['returnto'] = $title->getPrefixedUrl();
                    }
                    $request = new FauxRequest($requestData);
                    require_once 'includes/SpecialUserlogin.php';
                    $form = new LoginForm($request);
                    $form->mainLoginForm("You need to sign in to unmerge pages<br/><br/>", '');
                    return;
                }
                if ($wgUser->isBlocked()) {
                    $wgOut->blockedPage();
                    return;
                } else {
                    if (wfReadOnly()) {
                        $wgOut->readOnlyPage();
                        return;
                    }
                }
                $wgOut->setPagetitle('Unmerge');
                $results = $reviewForm->unmerge();
            } else {
                $wgOut->setPageTitle('Review merge');
                $wrSidebarHtml = $reviewForm->getReviewSideText();
                $results = $reviewForm->getReviewResults();
                $unmerge = $reviewForm->getUnmergeInfo();
            }
        }
    }
    $wgOut->addHTML($unmerge . $results);
}
Beispiel #2
0
 public function execute($par)
 {
     global $wgUser, $wgCommandLineMode, $wgLang, $wgOut, $wrAdminUserName;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if ($wgUser->isLoggedIn()) {
         if ($wgUser->getName() == $wrAdminUserName) {
             $user = User::newFromName($par);
         } else {
             $user = $wgUser;
         }
         $msg = '';
         if ($user->getID() > 0) {
             $user->setOption('enotifwatchlistpages', 0);
             $user->setOption('enotifusertalkpages', 0);
             $user->setOption('enotifminoredits', 0);
             $user->setOption('disablemail', 1);
             $user->saveSettings();
         } else {
             $msg = $user->getName() . ' not found';
         }
         $this->show($msg);
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('Unsubscribe')));
         require_once 'includes/SpecialUserlogin.php';
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in to unsubscribe<br/><br/>", '');
     }
 }
Beispiel #3
0
 public function execute($par)
 {
     global $wgUser, $wgCommandLineMode, $wgLang, $wgOut, $wrAdminUserName;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if ($wgUser->isLoggedIn() && $wgUser->getName() == $wrAdminUserName) {
         $pieces = explode('/', $par);
         if (count($pieces) > 1 && strlen($pieces[1]) == 8) {
             $pieces[1] .= '000000';
         }
         $user = User::newFromName($pieces[0]);
         $msg = '';
         if (count($pieces) == 2 && $user->getID() > 0 && strlen($pieces[1]) == 14) {
             $user->setOption('wrnoads', $pieces[1]);
             $user->saveSettings();
         } else {
             $msg = $pieces[0] . ' not found or date incorrect';
         }
         $this->show($msg);
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('NoAds')));
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in<br/><br/>", '');
     }
 }
Beispiel #4
0
/**
 * constructor
 */
function wfSpecialUserlogin()
{
    global $wgCommandLineMode;
    global $wgRequest;
    if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
        User::SetupSession();
    }
    $form = new LoginForm($wgRequest);
    $form->execute();
}
Beispiel #5
0
function wfSpecialAddPage($par)
{
    global $wgOut, $wgRequest, $wgUser, $wgLang, $wgCommandLineMode, $wgScriptPath;
    $error = '';
    $editParms = '';
    $title = null;
    $addPageForm = new AddPageForm();
    // read query parameters into variables
    $addPageForm->readQueryParms($par);
    if (!$wgUser->isLoggedIn()) {
        if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
            User::SetupSession();
        }
        $request = new FauxRequest(array('returnto' => $wgLang->specialPage('AddPage') . '/' . $addPageForm->namespace));
        require_once 'includes/SpecialUserlogin.php';
        $form = new LoginForm($request);
        $form->mainLoginForm("You need to log in to add pages<br/><br/>", '');
        return;
    }
    if ($wgUser->isBlocked()) {
        $wgOut->blockedPage();
        return;
    }
    if (wfReadOnly()) {
        $wgOut->readOnlyPage();
        return;
    }
    // redirect?
    list($redirTitle, $error) = $addPageForm->getRedirTitleOrError();
    if ($redirTitle != null) {
        $editParms = $addPageForm->getEditParms();
        $wgOut->redirect($redirTitle->getFullURL('action=edit' . $editParms));
        return;
    }
    // get form text
    $formHtml = $addPageForm->getFormHtml();
    $pageTitle = $addPageForm->getPageTitle();
    $pageHeading = $addPageForm->getPageHeading();
    $msgId = $addPageForm->getMessageId();
    // set up page
    $wgOut->setPagetitle($pageTitle);
    $wgOut->setArticleRelated(false);
    $wgOut->setRobotpolicy('noindex,nofollow');
    if ($addPageForm->namespace == NS_PERSON || $addPageForm->namespace == NS_FAMILY || $addPageForm->namespace == NS_SOURCE || $addPageForm->namespace == NS_PLACE) {
        $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/search.31.js\"></script>");
        $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/autocomplete.10.js\"></script>");
    }
    $wgOut->addHTML("<h2>{$pageHeading}</h2>");
    if ($error) {
        $wgOut->addHTML("<p><font color=red>{$error}</font></p>");
    }
    $wgOut->addHTML($formHtml);
    $wgOut->addWikiText("\n\n" . wfmsg($msgId));
}
Beispiel #6
0
 public function execute($par)
 {
     global $wgUser, $wgCommandLineMode, $wgLang;
     if ($wgUser->isLoggedIn()) {
         $this->show();
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('Dashboard')));
         require_once 'includes/SpecialUserlogin.php';
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in to view your dashboard<br/><br/>", '');
     }
 }
/**
 * constructor
 */
function wfSpecialUserlogin()
{
    global $wgCommandLineMode;
    global $wgRequest;
    global $wgAutoLogin, $wgOut;
    if (!$wgAutoLogin) {
        if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
            User::SetupSession();
        }
        $form = new LoginForm($wgRequest);
        $form->execute();
    } else {
        $wgOut->addHTML(wfMsg('disabled_on_this_wiki'));
        $wgOut->returntoMain();
    }
}
Beispiel #8
0
 public function execute($par)
 {
     global $wgUser, $wgCommandLineMode, $wgLang;
     if ($wgUser->isLoggedIn()) {
         switch ($this->action) {
             case 'newPage':
                 $this->newPage();
                 break;
             default:
                 $this->show();
                 break;
         }
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('MyRelate')));
         require_once 'includes/SpecialUserlogin.php';
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in before using MyRelate<br/><br/>", '');
     }
 }
Beispiel #9
0
 public function execute($par)
 {
     global $wgUser, $wgCommandLineMode, $wgLang, $wgOut;
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if ($wgUser->isLoggedIn()) {
         switch ($this->action) {
             case 'newTree':
                 $this->newTree();
                 break;
             case 'shareTree':
                 $this->shareTree();
                 break;
             case 'renameTree':
                 $this->renameTree();
                 break;
             case 'deleteTree':
                 $this->deleteTree();
                 break;
             default:
                 $this->show();
                 break;
         }
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('FamilyTree')));
         require_once 'includes/SpecialUserlogin.php';
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in before creating trees<br/><br/>", '');
     }
 }
Beispiel #10
0
 public function execute()
 {
     global $wgCommandLineMode, $wgLang, $wgOut;
     if ($this->username) {
         if (!$this->user || !$this->user->getID()) {
             $wgOut->addHtml('<p><font color="red">User not found</font></p>');
             return;
         }
         if ($this->otherUsername) {
             $this->showUserNetwork();
         } else {
             $this->showFullNetwork();
         }
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('Network')));
         require_once 'includes/SpecialUserlogin.php';
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in to view your network<br/><br/>", '');
     }
 }
Beispiel #11
0
 /**
  * Perform one of the "standard" actions
  */
 function performAction(&$output, &$article, &$title, &$user, &$request)
 {
     wfProfileIn('MediaWiki::performAction');
     $action = $this->getVal('Action');
     if (in_array($action, $this->getVal('DisabledActions', array()))) {
         /* No such action; this will switch to the default case */
         $action = 'nosuchaction';
     }
     switch ($action) {
         case 'view':
             $output->setSquidMaxage($this->getVal('SquidMaxage'));
             $article->view();
             break;
         case 'watch':
         case 'unwatch':
         case 'delete':
         case 'revert':
         case 'rollback':
         case 'protect':
         case 'unprotect':
         case 'info':
         case 'markpatrolled':
         case 'render':
         case 'deletetrackback':
         case 'purge':
             $article->{$action}();
             break;
         case 'print':
             $article->view();
             break;
         case 'dublincore':
             if (!$this->getVal('EnableDublinCoreRdf')) {
                 wfHttpError(403, 'Forbidden', wfMsg('nodublincore'));
             } else {
                 require_once 'includes/Metadata.php';
                 wfDublinCoreRdf($article);
             }
             break;
         case 'creativecommons':
             if (!$this->getVal('EnableCreativeCommonsRdf')) {
                 wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons'));
             } else {
                 require_once 'includes/Metadata.php';
                 wfCreativeCommonsRdf($article);
             }
             break;
         case 'credits':
             require_once 'includes/Credits.php';
             showCreditsPage($article);
             break;
         case 'submit':
             if (!$this->getVal('CommandLineMode') && !$request->checkSessionCookie()) {
                 /* Send a cookie so anons get talk message notifications */
                 User::SetupSession();
             }
             /* Continue... */
         /* Continue... */
         case 'edit':
             $internal = $request->getVal('internaledit');
             $external = $request->getVal('externaledit');
             $section = $request->getVal('section');
             $oldid = $request->getVal('oldid');
             if (!$this->getVal('UseExternalEditor') || $action == 'submit' || $internal || $section || $oldid || !$user->getOption('externaleditor') && !$external) {
                 $editor = new EditPage($article);
                 $editor->submit();
             } elseif ($this->getVal('UseExternalEditor') && ($external || $user->getOption('externaleditor'))) {
                 $mode = $request->getVal('mode');
                 $extedit = new ExternalEdit($article, $mode);
                 $extedit->edit();
             }
             break;
         case 'history':
             if ($_SERVER['REQUEST_URI'] == $title->getInternalURL('action=history')) {
                 $output->setSquidMaxage($this->getVal('SquidMaxage'));
             }
             $history = new PageHistory($article);
             $history->history();
             break;
         case 'raw':
             $raw = new RawPage($article);
             $raw->view();
             break;
         default:
             if (wfRunHooks('UnknownAction', array($action, $article))) {
                 $output->showErrorPage('nosuchaction', 'nosuchactiontext');
             }
     }
     wfProfileOut('MediaWiki::performAction');
 }
 case 'creativecommons':
     if (!$wgEnableCreativeCommonsRdf) {
         wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons'));
     } else {
         require_once 'includes/Metadata.php';
         wfCreativeCommonsRdf($wgArticle);
     }
     break;
 case 'credits':
     require_once 'includes/Credits.php';
     showCreditsPage($wgArticle);
     break;
 case 'submit':
     if (!$wgCommandLineMode && !$wgRequest->checkSessionCookie()) {
         # Send a cookie so anons get talk message notifications
         User::SetupSession();
     }
     # Continue...
 # Continue...
 case 'edit':
     $internal = $wgRequest->getVal('internaledit');
     $external = $wgRequest->getVal('externaledit');
     $section = $wgRequest->getVal('section');
     $oldid = $wgRequest->getVal('oldid');
     if (!$wgUseExternalEditor || $action == 'submit' || $internal || $section || $oldid || !$wgUser->getOption('externaleditor') && !$external) {
         require_once 'includes/EditPage.php';
         $editor = new EditPage($wgArticle);
         $editor->submit();
     } elseif ($wgUseExternalEditor && ($external || $wgUser->getOption('externaleditor'))) {
         require_once 'includes/ExternalEdit.php';
         $mode = $wgRequest->getVal('mode');
Beispiel #13
0
/**
 * Called to display the Special:Merge page
 *
 * @param unknown_type $par
 * @param unknown_type $specialPage
 */
function wfSpecialMerge($par = NULL, $specialPage)
{
    global $wgOut, $wgScriptPath, $wgCommandLineMode, $wrSidebarHtml, $wgMemc, $wgUser;
    //		$sideText = '';
    $mergeForm = new MergeForm();
    // read query parameters into variables
    $mergeForm->readQueryParms($par);
    if (!$wgUser->isLoggedIn()) {
        if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
            User::SetupSession();
        }
        $mergeTargetTitle = $mergeForm->getMergeTargetTitle();
        $requestData = array();
        if ($mergeTargetTitle) {
            $requestData['returnto'] = $mergeTargetTitle->getPrefixedUrl();
        }
        $request = new FauxRequest($requestData);
        require_once 'includes/SpecialUserlogin.php';
        $form = new LoginForm($request);
        $form->mainLoginForm("You need to sign in to merge pages<br/><br/>", '');
        return;
    }
    if ($wgUser->isBlocked()) {
        $wgOut->blockedPage();
        return;
    }
    if (wfReadOnly()) {
        $wgOut->readOnlyPage();
        return;
    }
    $isGedcom = $mergeForm->isGedcom();
    $wgOut->setPageTitle($isGedcom ? 'Update pages' : 'Merge pages');
    if ($mergeForm->getFormAction() == 'Cancel') {
        $output = '<H2>Merge Cancelled</H2><p>You can use the <b>back</b> button on your browser to navigate back to where you were, or select an item from the menu.</p>';
    } else {
        if ($mergeForm->getFormAction() == 'NotMatch') {
            $output = $mergeForm->getNotMatchResults();
        } else {
            if ($mergeForm->getFormAction() != 'Merge' || !$mergeForm->preMerge()) {
                $output = '<H2>Unable to merge</H2>' . $mergeForm->getWarnings() . '<p>Press the <b>back</b> button on your browser to go back to the Compare page.</p>';
            } else {
                if ($mergeForm->isSecondPhase()) {
                    // disallow merging the same page twice in a row (result of double-click)
                    if ($mergeForm->isGedcom()) {
                        $cacheKey = 'mergekey:ged:' . $mergeForm->gedcomId . $mergeForm->gedcomKey;
                    } else {
                        $cacheKey = 'mergekey:' . $wgUser->getID() . $mergeForm->editToken;
                    }
                    if (!$wgMemc->get($cacheKey)) {
                        $wgMemc->set($cacheKey, 't', 5);
                        $output = $mergeForm->doMerge();
                    }
                } else {
                    $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/merge.10.js\"></script>");
                    //		$mergeText = $isGedcom ? 'update' : 'merge';
                    //		$mergeButton = $isGedcom ? 'Update' : 'Merge';
                    //		$sideText = '<h3>Instructions</h3><p>' .
                    //						($mergeForm->getMergesCount() > 1 ? "For each set of pages to $mergeText, check" : 'Check') .
                    //						" the boxes next to the pieces of information you want included in the {$mergeText}d page.</p>" .
                    //						($isGedcom ? '<p><b>Updating pages is optional.</b>  It is not necessary or desirable to update these pages unless you have more accurate information or reliable sources to add.</b></p>'
                    //								: '<p>The <i>target</i> is the page that the other page(s) will be merged into.</p>').
                    //						'<p>The box colors are for your information only:</p>'.
                    //						'<p><font color="green">Green</font> boxes mean the information is specific and matches exactly.</p>'.
                    //						'<p><font color="yellow">Yellow</font> boxes mean the information is non-specific (missing some pieces) or is a partial match.</p>'.
                    //						'<p><font color="red">Red</font> boxes mean the information differs.</p>'.
                    //						"<p>Once you have chosen which pieces of information to include, click on the \"$mergeButton\" button at the bottom of the screen to $mergeText the pages.</p>".
                    //						'<p>(<a href="/wiki/Help:Merging_pages">more help</a>)</p>';
                    $output = $mergeForm->getMergeResults();
                }
            }
        }
    }
    //   $skin = $wgUser->getSkin();
    $wrSidebarHtml = wfMsgWikiHtml('MergeHelp');
    $wgOut->addHTML($output);
}
 public function getResults()
 {
     global $wgUser, $wgCommandLineMode, $wgLang;
     if ($this->userName) {
         $results = '<p>Changes made in the past 24 hours are not reflected</p>';
         $u = User::newFromName($this->userName);
         if (!$u || !$u->getID()) {
             $results .= '<font color="red">User not found</font>';
         } else {
             $sk = $wgUser->getSkin();
             // issue db query to get the family trees, sort afterward
             $dbr =& wfGetDB(DB_SLAVE);
             $res = $dbr->select(array('watchlist', 'duplicates'), array('dp_namespace', 'dp_title', 'dp_match_titles'), array('wl_user' => $u->getID(), 'wl_namespace=dp_namespace', 'wl_title=dp_title'));
             $compareTitle = Title::makeTitle(NS_SPECIAL, 'Compare');
             $searchTitle = Title::makeTitle(NS_SPECIAL, 'Search');
             $found = false;
             while ($row = $dbr->fetchObject($res)) {
                 if (!$found) {
                     $results .= '<ul>';
                     $found = true;
                 }
                 $title = Title::makeTitle($row->dp_namespace, $row->dp_title);
                 $namespace = $row->dp_namespace == NS_PERSON ? 'Person' : 'Family';
                 if ($row->dp_match_titles) {
                     $baseTitle = $compareTitle;
                     $query = 'ns=' . $namespace . '&compare=' . urlencode($row->dp_title . '|' . $row->dp_match_titles);
                 } else {
                     $baseTitle = $searchTitle;
                     $query = 'match=on&ns=' . $namespace . '&pagetitle=' . urlencode($row->dp_title);
                 }
                 $results .= '<li>' . $sk->makeKnownLinkObj($baseTitle, htmlspecialchars($title->getPrefixedText()), $query) . ' &nbsp; (<i>' . $sk->makeKnownLinkObj($baseTitle, 'open in new window', $query, '', '', 'target="_blank"') . '</i>)</li>';
             }
             $dbr->freeResult($res);
             if ($found) {
                 $results .= '</ul>';
             } else {
                 $results .= '<p>No possible duplicates found.</p>';
             }
         }
         return $results;
     } else {
         if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
             User::SetupSession();
         }
         $request = new FauxRequest(array('returnto' => $wgLang->specialPage('ShowDuplicates')));
         require_once 'includes/SpecialUserlogin.php';
         $form = new LoginForm($request);
         $form->mainLoginForm("You need to log in to view your possible duplicates<br/><br/>", '');
         return '';
     }
 }