ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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),
47  new ilUserProfileIncompleteRequestTargetAdjustmentCase($this->user, $this->ctrl),
48  new ilUserPasswordResetRequestTargetAdjustmentCase($this->user, $this->ctrl)
49  );
50  }
51 
55  protected function storeRequest()
56  {
60  global $https;
61 
62  if(!ilSession::get('orig_request_target'))
63  {
64  //#16324 don't use the complete REQUEST_URI
65  $url = substr($_SERVER['REQUEST_URI'], (strrpos($_SERVER['REQUEST_URI'], "/")+1));
66 
67  ilSession::set('orig_request_target', $url);
68  }
69  }
70 
74  public function adjust()
75  {
76  if(defined('IL_CERT_SSO'))
77  {
78  return false;
79  }
81  {
82  return false;
83  }
84  else if($this->ctrl->isAsynch())
85  {
86  return false;
87  }
88  else if(in_array(basename($_SERVER['PHP_SELF']), array('logout.php')))
89  {
90  return false;
91  }
92  else if(!$this->user->getId() || $this->user->isAnonymous())
93  {
94  return false;
95  }
96 
97  foreach($this->cases as $case)
98  {
99  if($case->isInFulfillment())
100  {
101  return false;
102  }
103 
104  if($case->shouldAdjustRequest())
105  {
106  if($case->shouldStoreRequestTarget())
107  {
108  $this->storeRequest();
109  }
110  $case->adjust();
111  return true;
112  }
113  }
114 
115  return false;
116  }
117 }