Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezredirectmanager.php
Go to the documentation of this file.
1 <?php
17 class eZRedirectManager
18 {
19
39 static function redirectURI( $module, $default, $view = true, $disallowed = false, $preferredURI = false )
40 {
41 $uri = false;
42 $http = eZHTTPTool::instance();
43
44 if ( $preferredURI ) // check if $preferredURI is a valid URI
45 return $preferredURI;
46
47 if ( $view )
48 {
49 if ( $http->hasSessionVariable( "LastAccessesURI", false ) )
50 {
51 $uri = $http->sessionVariable( "LastAccessesURI" );
52 }
53 }
54 else
55 {
56 if ( $http->hasSessionVariable( "LastAccessedModifyingURI", false ) )
57 {
58 $uri = $http->sessionVariable( "LastAccessedModifyingURI" );
59 }
60 }
61
62 if ( $uri !== false )
63 {
64 $moduleURI = $module->functionURI( $module->currentView() );
65 // Check for correct module/view
66 if ( substr( $uri, 0, strlen( $moduleURI ) ) == $moduleURI )
67 {
68 // Check parameters
69 $moduleURI = $module->currentRedirectionURI();
70 if ( $moduleURI == $uri )
71 $uri = false;
72 }
73 }
74
75 // Check for disallowed urls
76 if ( $uri !== false and
77 is_array( $disallowed ) )
78 {
79 if ( in_array( $uri, $disallowed ) )
80 $uri = false;
81 }
82
83 if ( $uri === false )
84 {
85 // If no default is set we should return false.
86 if ( $default === false )
87 return false;
88 $uri = $default;
89 }
90
91 return $uri;
92 }
93
114 static function redirectTo( $module, $default, $view = true, $disallowed = false, $preferredURI = false )
115 {
116 $uri = eZRedirectManager::redirectURI( $module, $default, $view, $disallowed, $preferredURI );
117 if ( $uri === false )
118 return false;
119 $module->redirectTo( $uri );
120 return true;
121 }
122 }
123
124 ?>
eZHTTPTool\instance
static instance()
Definition: ezhttptool.php:189
eZRedirectManager
Handles generation of redirection URIs and redirection.
Definition: ezredirectmanager.php:18
eZRedirectManager\redirectTo
static redirectTo( $module, $default, $view=true, $disallowed=false, $preferredURI=false)
Definition: ezredirectmanager.php:114
eZRedirectManager\redirectURI
static redirectURI( $module, $default, $view=true, $disallowed=false, $preferredURI=false)
Definition: ezredirectmanager.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.