/**
  * @return boolean
  */
 public function adjust()
 {
     if (defined('IL_CERT_SSO')) {
         return false;
     } else {
         if (!ilContext::supportsRedirects()) {
             return false;
         } else {
             if ($this->ctrl->isAsynch()) {
                 return false;
             } else {
                 if (in_array(basename($_SERVER['PHP_SELF']), array('logout.php'))) {
                     return false;
                 } else {
                     if (!$this->user->getId() || $this->user->isAnonymous()) {
                         return false;
                     }
                 }
             }
         }
     }
     foreach ($this->cases as $case) {
         if ($case->isInFulfillment()) {
             return false;
         }
         if ($case->shouldAdjustRequest()) {
             if ($case->shouldStoreRequestTarget()) {
                 $this->storeRequest();
             }
             $case->adjust();
             return true;
         }
     }
     return false;
 }
 /**
  * Redirects to target url if context supports it
  * 
  * @param string $a_target
  * @param string $a_message_id
  * @param array $a_message_details
  */
 protected static function redirect($a_target, $a_message_id, $a_message_static)
 {
     // #12739
     if (defined("ILIAS_HTTP_PATH") && !stristr($a_target, ILIAS_HTTP_PATH)) {
         $a_target = ILIAS_HTTP_PATH . "/" . $a_target;
     }
     if (ilContext::supportsRedirects()) {
         ilUtil::redirect($a_target);
     } else {
         $message = self::translateMessage($a_message_id, $a_message_static);
         // user-directed linked message
         if (ilContext::usesHTTP() && ilContext::hasHTML()) {
             $link = self::translateMessage("init_error_redirect_click", array("en" => 'Please click to continue.', "de" => 'Bitte klicken um fortzufahren.'));
             $mess = $message . '<br /><a href="' . $a_target . '">' . $link . '</a>';
         } else {
             // not much we can do here
             $mess = $message;
             if (!trim($mess)) {
                 $mess = self::translateMessage("init_error_redirect_info", array("en" => 'Redirect not supported by context.', "de" => 'Weiterleitungen werden durch Kontext nicht unterstützt.')) . ' (' . $a_target . ')';
             }
         }
         self::abortAndDie($mess);
     }
 }
Exemplo n.º 3
0
 public function login()
 {
     $skipClasses = array('ilpasswordassistancegui', 'ilaccountregistrationgui');
     $skipFiles = array('pwassist.php');
     if (in_array(strtolower($_REQUEST['cmdClass']), $skipClasses)) {
         return;
     } else {
         $script = pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME);
         if (in_array(strtolower($script), $skipFiles)) {
             return;
         }
     }
     if (!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && (preg_match('/.*login\\.php$/', $_SERVER['SCRIPT_NAME']) || (in_array($_REQUEST['cmd'], array('showLogin', 'showTermsOfService')) || isset($_POST['change_lang_to'])) && strtolower($_REQUEST['cmdClass']) == 'ilstartupgui')) {
         return;
     }
     if (!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && preg_match('/.*login\\.php$/', $_SERVER['SCRIPT_NAME'])) {
         return;
     }
     if (ilContext::supportsRedirects() && !isset($_GET['passed_sso']) && (!defined('IL_CERT_SSO') || IL_CERT_SSO == false)) {
         // redirect to sso
         // this part is executed in default ilias context...
         $path = $_SERVER['REQUEST_URI'];
         if ($path[0] == '/') {
             $path = substr($path, 1);
         }
         if (substr($path, 0, 4) != 'http') {
             $parts = parse_url(ILIAS_HTTP_PATH);
             $path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path;
         }
         $path = urlencode($path);
         ilUtil::redirect(ilUtil::getHtmlPath('/sso/index.php?force_mode_apache=1&r=' . $path . '&cookie_path=' . IL_COOKIE_PATH . '&ilias_path=' . ILIAS_HTTP_PATH));
     } else {
         return parent::login();
     }
 }
 /**
  * Redirects to target url if context supports it
  * 
  * @param string $a_target
  * @param string $a_message_details
  */
 protected static function redirect($a_target, $a_message_details)
 {
     if (ilContext::supportsRedirects()) {
         ilUtil::redirect($a_target);
     } else {
         // user-directed linked message
         if (ilContext::usesHTTP() && ilContext::hasHTML()) {
             $mess = $a_message_details . ' Please <a href="' . $a_target . '">click here</a> to continue.';
         } else {
             // not much we can do here
             $mess = $a_message_details;
             if (!trim($mess)) {
                 $mess = 'Redirect not supported by context (' . $a_target . ')';
             }
         }
         self::abortAndDie($mess);
     }
 }