コード例 #1
0
 /**
  * This function is called if the special page is accessed
  * inspired by @see includes/special/SpecialUserlogout.php
  * @param $par parameters
  * @see includes/SpecialPage.php
  */
 function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser;
     $this->setHeaders();
     $param = $wgRequest->getText('param');
     // build the page
     $html = "";
     if (!$this->multiAuthPlugin->isLoggedIn()) {
         // check if we should be redirected to an external URL after complete logout
         if ($this->multiAuthPlugin->config['internal']['redirectAfterLogoutComplete'] != '') {
             // do the redirect
             header('Location: ' . $this->multiAuthPlugin->config['internal']['redirectAfterLogoutComplete']);
             exit;
             // Stop execution here
         } else {
             $html .= "<p>" . wfMsg('msg_logoutSuccess') . "</p>\n";
         }
     } else {
         // get information about the currently active authentication method
         $currentMethodName = $this->multiAuthPlugin->getCurrentMethodName();
         if (!empty($currentMethodName) && $currentMethodName != 'local') {
             $this->doExternalLogout($html);
         } else {
             $this->doLocalLogout($html);
         }
     }
     $wgOut->addHTML($html);
     $wgOut->returnToMain();
 }
コード例 #2
0
 /**
  * This function is called when the special page is accessed
  * @param $par parameters
  * @see includes/SpecialPage.php
  */
 function execute($par)
 {
     global $wgRequest, $wgOut;
     $this->setHeaders();
     $param = $wgRequest->getText('param');
     wfDebugLog(basename(__FILE__, ".php"), __METHOD__ . ': ' . "Parameters: {$param}");
     // build the page
     $html = "";
     if ($this->multiAuthPlugin->isLoggedIn()) {
         // login success
         $html .= "<p>" . wfMsg('msg_loginSuccess') . "</p>\n";
     } else {
         if (isset($_GET['method']) && $this->multiAuthPlugin->isValidMethod($_GET['method'])) {
             $this->initLogin($_GET['method']);
             // the above function will issue a redirect
         } else {
             if (!is_null($this->multiAuthPlugin->getCurrentMethodName()) && $this->multiAuthPlugin->getCurrentMethodName() != 'local') {
                 // external authentication success but not authorized
                 $html .= "<p>" . wfMsg('msg_notAuthorized') . "</p>\n";
                 unset($_SESSION['MA_methodName']);
             } else {
                 $this->addLoginLinks($html);
             }
         }
     }
     $wgOut->addHTML($html);
     $wgOut->returnToMain();
 }