ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceRequestTargetAdjustmentCase.php';
42 require_once 'Services/User/classes/class.ilUserProfileIncompleteRequestTargetAdjustmentCase.php';
43 require_once 'Services/User/classes/class.ilUserPasswordResetRequestTargetAdjustmentCase.php';
44
45 $this->cases = array(
49 );
50 }
51
55 protected function storeRequest()
56 {
57 if(!ilSession::get('orig_request_target'))
58 {
59 //#16324 don't use the complete REQUEST_URI
60 $url = substr($_SERVER['REQUEST_URI'], (strrpos($_SERVER['REQUEST_URI'], '/') +1 ));
61
62 ilSession::set('orig_request_target', $url);
63 }
64 }
65
69 public function adjust()
70 {
71 if(defined('IL_CERT_SSO'))
72 {
73 $GLOBALS['DIC']->logger()->init()->debug('CERT SSO request. No adjustment.');
74 return false;
75 }
77 {
78 $GLOBALS['DIC']->logger()->init()->debug('Context does not support redirects. No adjustment.');
79 return false;
80 }
81 else if($this->ctrl->isAsynch())
82 {
83 $GLOBALS['DIC']->logger()->init()->debug('Async request. No adjustment.');
84 return false;
85 }
86 else if(in_array(basename($_SERVER['PHP_SELF']), array('logout.php')))
87 {
88 $GLOBALS['DIC']->logger()->init()->debug('Logout request. No adjustment.');
89 return false;
90 }
91 else if(!$this->user->getId() || $this->user->isAnonymous())
92 {
93 $GLOBALS['DIC']->logger()->init()->debug('Anyonymous request. No adjustment.');
94 return false;
95 }
96 else if(ilSession::get(__CLASS__ . '_passed'))
97 {
98 $GLOBALS['DIC']->logger()->init()->debug(__CLASS__ . ' already passed in the current user session.');
99 return false;
100 }
101
102 foreach($this->cases as $case)
103 {
104 if($case->isInFulfillment())
105 {
106 $GLOBALS['DIC']->logger()->init()->debug('Case is in fullfillment:' . get_class($case));
107 return false;
108 }
109
110 if($case->shouldAdjustRequest())
111 {
112
113 $GLOBALS['DIC']->logger()->init()->debug('Case required adjustment:' . get_class($case));
114 if($case->shouldStoreRequestTarget())
115 {
116 $this->storeRequest();
117 }
118 $case->adjust();
119 return true;
120 }
121 }
122
123 ilSession::set(__CLASS__ . '_passed', 1);
124 return false;
125 }
126}
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['loaded']
Global hash that tracks already loaded includes.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$url
Definition: shib_logout.php:72
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']