ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilUserRequestTargetAdjustment.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
12 protected $ctrl;
13
17 protected $user;
18
22 protected $cases = array();
23
29 {
30 $this->user = $user;
31 $this->ctrl = $ctrl;
32
33 $this->initCases();
34 }
35
39 protected function initCases()
40 {
41 $this->cases = array(
45 );
46 }
47
51 protected function storeRequest()
52 {
53 if (!ilSession::get('orig_request_target')) {
54 //#16324 don't use the complete REQUEST_URI
55 $url = substr($_SERVER['REQUEST_URI'], (strrpos($_SERVER['REQUEST_URI'], '/') + 1));
56
57 ilSession::set('orig_request_target', $url);
58 }
59 }
60
64 public function adjust()
65 {
66 if (defined('IL_CERT_SSO')) {
67 $GLOBALS['DIC']->logger()->init()->debug('CERT SSO request. No adjustment.');
68 return false;
69 } elseif (!ilContext::supportsRedirects()) {
70 $GLOBALS['DIC']->logger()->init()->debug('Context does not support redirects. No adjustment.');
71 return false;
72 } elseif ($this->ctrl->isAsynch()) {
73 $GLOBALS['DIC']->logger()->init()->debug('Async request. No adjustment.');
74 return false;
75 } elseif (in_array(basename($_SERVER['PHP_SELF']), array('logout.php'))) {
76 $GLOBALS['DIC']->logger()->init()->debug('Logout request. No adjustment.');
77 return false;
78 } elseif (!$this->user->getId() || $this->user->isAnonymous()) {
79 $GLOBALS['DIC']->logger()->init()->debug('Anyonymous request. No adjustment.');
80 return false;
81 } elseif (ilSession::get(__CLASS__ . '_passed')) {
82 $GLOBALS['DIC']->logger()->init()->debug(__CLASS__ . ' already passed in the current user session.');
83 return false;
84 }
85
86 foreach ($this->cases as $case) {
87 if ($case->isInFulfillment()) {
88 $GLOBALS['DIC']->logger()->init()->debug('Case is in fullfillment:' . get_class($case));
89 return false;
90 }
91
92 if ($case->shouldAdjustRequest()) {
93 $GLOBALS['DIC']->logger()->init()->debug('Case required adjustment:' . get_class($case));
94 if ($case->shouldStoreRequestTarget()) {
95 $this->storeRequest();
96 }
97 $case->adjust();
98 return true;
99 }
100 }
101
102 ilSession::set(__CLASS__ . '_passed', 1);
103 return false;
104 }
105}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static supportsRedirects()
Are redirects supported?
This class provides processing control methods.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
Class ilUserProfileIncompleteAndPasswordResetRequestTargetAdjustmentCase.
Class ilUserAccountMaintenanceEnforcement.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
$url
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']