Commit f89d3f82 authored by Penom Nom's avatar Penom Nom
Browse files

redirection view for unlogged users

parent e242536c
......@@ -121,6 +121,21 @@ class tx_nG6_pi1 extends tslib_pibase {
}
/**
* return a redirection view
* @return string
*/
function redirect_view(){
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$currentUrl = $protocol . '://' . $host . $script ;
return '<div class="sub-content"><br/><div class="alert alert-warning"><b>Access denied</b> - You are not authorized to access this page. You will be redirected in 3 seconds ' .
'Click <a href="' . $currentUrl . '">here</a> if the redirection did not work'.
'<meta http-equiv="refresh" content="3; URL=' . $currentUrl . '"></div></div>';
}
/**
* Return the project view
*/
......@@ -201,7 +216,7 @@ class tx_nG6_pi1 extends tslib_pibase {
}
return $smarty->fetch('project_view.tpl');
} else {
return "<div class='alert alert-error'><b>Access denied</b> - You are not authorized to access this page.</div>";
return $this->redirect_view();
}
}
......@@ -277,7 +292,7 @@ class tx_nG6_pi1 extends tslib_pibase {
}
return $smarty->fetch('run_view.tpl');
} else {
return "<div class='alert alert-error'><b>Access denied</b> - You are not authorized to access this page.</div>";
return $this->redirect_view();
}
}
......
......@@ -31,7 +31,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{* If no project can be displayed *}
{if $projects|@count == 0 || ($projects|@count == 1 && $projects[key($projects)].hidden == 1 && !$projects[key($projects)].is_admin)}
<div class="alert alert-info">Sorry no results to display</div>
<div class="sub-content" >
<br/>
<div class="alert alert-info">Sorry no results to display</div>
</div>
{* If a single project has to be displayed *}
{elseif $single_project_display}
......
......@@ -29,7 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{* If no runs can be displayed *}
{if $runs|@count == 0 || ($runs|@count == 1 && $runs[key($runs)].hidden == 1 && !$runs[key($runs)].is_admin) }
Sorry no results to display
<div class="sub-content">
<br/>
<div class="alert alert-info" >Sorry no results to display</div>
</div>
{* If a single run has to be displayed *}
{elseif $single_run_display}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment