mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
commit
ecf70a63f0
@ -35,14 +35,20 @@ class redirectDiffrentLang
|
||||
$setting_language = setting_value('streams::default_locale');
|
||||
$current_language = $request->session()->get('_locale', $setting_language);
|
||||
$request_url = ltrim($request->getRequestUri(), '/');
|
||||
|
||||
// If the segment(1) is admin and language parameters is not null, no forwarding will be made.
|
||||
if ($request->segment(1) == "admin" and in_array($current_language, explode('/', $original_url))) {
|
||||
return $this->redirect->to($request->fullUrl());
|
||||
}
|
||||
|
||||
if ($current_language != $setting_language) {
|
||||
if ($request_url != "" and $original_url != '/' . $current_language . '/' . $request_url) {
|
||||
|
||||
// If the method is get, no forwarding will be made.
|
||||
// If the segment(1) is admin, no forwarding will be made.
|
||||
|
||||
if ($request->method() == "GET" and $request->segment(1) != "admin" and $request_url != "" and $original_url != '/' . $current_language . '/' . $request_url) {
|
||||
return $this->redirect->to('/' . $current_language . '/' . $request_url);
|
||||
}
|
||||
} else {
|
||||
if ($request_url == "" and '/' . $current_language != $original_url) {
|
||||
$this->redirect->to($current_language);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<html class="nojs ms lt_ie7" lang="en"><![endif]-->
|
||||
<!--[if IE 7]>
|
||||
<html class="nojs ms ie7" lang="en"><![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html class="nojs ms ie8" lang="en"><![endif]-->
|
||||
<!--[if gt IE 8]>
|
||||
<html class="nojs ms" lang="en"><![endif]-->
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
{% include "visiosoft.theme.base::partials/metadata" %}
|
||||
{% block styles %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{% include "visiosoft.theme.base::partials/header" %}
|
||||
|
||||
<main id="main">
|
||||
<div class="container">
|
||||
|
||||
{% include "visiosoft.theme.base::partials/messages" %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{% include "visiosoft.theme.base::partials/footer" %}
|
||||
{% include "visiosoft.theme.base::partials/settings" %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user