ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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(
46  new ilTermsOfServiceRequestTargetAdjustmentCase($this->user, $this->ctrl),
49  );
50  }
51 
55  protected function storeRequest()
56  {
57  if (!ilSession::get('orig_request_target')) {
58  //#16324 don't use the complete REQUEST_URI
59  $url = substr($_SERVER['REQUEST_URI'], (strrpos($_SERVER['REQUEST_URI'], '/') +1));
60 
61  ilSession::set('orig_request_target', $url);
62  }
63  }
64 
68  public function adjust()
69  {
70  if (defined('IL_CERT_SSO')) {
71  $GLOBALS['DIC']->logger()->init()->debug('CERT SSO request. No adjustment.');
72  return false;
73  } elseif (!ilContext::supportsRedirects()) {
74  $GLOBALS['DIC']->logger()->init()->debug('Context does not support redirects. No adjustment.');
75  return false;
76  } elseif ($this->ctrl->isAsynch()) {
77  $GLOBALS['DIC']->logger()->init()->debug('Async request. No adjustment.');
78  return false;
79  } elseif (in_array(basename($_SERVER['PHP_SELF']), array('logout.php'))) {
80  $GLOBALS['DIC']->logger()->init()->debug('Logout request. No adjustment.');
81  return false;
82  } elseif (!$this->user->getId() || $this->user->isAnonymous()) {
83  $GLOBALS['DIC']->logger()->init()->debug('Anyonymous request. No adjustment.');
84  return false;
85  } elseif (ilSession::get(__CLASS__ . '_passed')) {
86  $GLOBALS['DIC']->logger()->init()->debug(__CLASS__ . ' already passed in the current user session.');
87  return false;
88  }
89 
90  foreach ($this->cases as $case) {
91  if ($case->isInFulfillment()) {
92  $GLOBALS['DIC']->logger()->init()->debug('Case is in fullfillment:' . get_class($case));
93  return false;
94  }
95 
96  if ($case->shouldAdjustRequest()) {
97  $GLOBALS['DIC']->logger()->init()->debug('Case required adjustment:' . get_class($case));
98  if ($case->shouldStoreRequestTarget()) {
99  $this->storeRequest();
100  }
101  $case->adjust();
102  return true;
103  }
104  }
105 
106  ilSession::set(__CLASS__ . '_passed', 1);
107  return false;
108  }
109 }
This class provides processing control methods.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
user()
Definition: user.php:4
Class ilUserAccountMaintenanceEnforcement.
Create styles array
The data for the language used.
Class ilUserProfileIncompleteAndPasswordResetRequestTargetAdjustmentCase.
$url
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
static supportsRedirects()
Are redirects supported?