Commit 20ce083d authored by Phil Höfer's avatar Phil Höfer
Browse files

Merge branch '823-custom-focus-funktioniert-nur-einmal' into 'development'

Resolve "Custom Focus funktioniert nur einmal"

Closes #823

See merge request !1339
parents 68464a40 7081ea3f
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App; use App;
use DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Jenssegers\Agent\Agent; use Jenssegers\Agent\Agent;
use LaravelLocalization; use LaravelLocalization;
use Response;
use DB;
use Log; use Log;
use Response;
class StartpageController extends Controller class StartpageController extends Controller
{ {
...@@ -22,9 +22,9 @@ class StartpageController extends Controller ...@@ -22,9 +22,9 @@ class StartpageController extends Controller
public function loadStartPage(Request $request) public function loadStartPage(Request $request)
{ {
$focusPages = []; $focusPages = [];
$theme = "default"; $theme = "default";
$optionParams = ['param_sprueche', 'param_newtab', 'param_maps', 'param_autocomplete', 'param_lang', 'param_key']; $optionParams = ['param_sprueche', 'param_newtab', 'param_maps', 'param_autocomplete', 'param_lang', 'param_key'];
$option_values = []; $option_values = [];
foreach ($optionParams as $param) { foreach ($optionParams as $param) {
...@@ -43,12 +43,12 @@ class StartpageController extends Controller ...@@ -43,12 +43,12 @@ class StartpageController extends Controller
if ($lang === 'de' || $lang === "en") { if ($lang === 'de' || $lang === "en") {
$lang = 'all'; $lang = 'all';
} }
# Sponsorenlinks # Sponsorenlinks
$sponsors = []; $sponsors = [];
try{ try {
$sponsors = DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get(); $sponsors = DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get();
} catch(\Illuminate\Database\QueryException $e){ } catch (\Illuminate\Database\QueryException $e) {
Log::info($e); Log::info($e);
} }
...@@ -89,9 +89,9 @@ class StartpageController extends Controller ...@@ -89,9 +89,9 @@ class StartpageController extends Controller
public function loadPlugin($params, $locale = "de") public function loadPlugin($params, $locale = "de")
{ {
$params = unserialize(base64_decode($params)); $params = unserialize(base64_decode($params));
$requests = $params; $requests = $params;
$params = []; $params = [];
foreach ($requests as $key => $value) { foreach ($requests as $key => $value) {
if (strpos($key, "param_") === 0) { if (strpos($key, "param_") === 0) {
$key = substr($key, strpos($key, "param_") + 6); $key = substr($key, strpos($key, "param_") + 6);
...@@ -146,12 +146,12 @@ class StartpageController extends Controller ...@@ -146,12 +146,12 @@ class StartpageController extends Controller
public function berlin(Request $request) public function berlin(Request $request)
{ {
$link = ""; $link = "";
$password = ""; $password = "";
if ($request->filled('eingabe')) { if ($request->filled('eingabe')) {
$password = getenv('berlin'); $password = getenv('berlin');
$password = md5($request->input('eingabe') . " -host:userpage.fu-berlin.de" . $password); $password = md5($request->input('eingabe') . " -host:userpage.fu-berlin.de" . $password);
$link = "/meta/meta.ger3?eingabe=" . $request->input('eingabe') . " -host:userpage.fu-berlin.de&focus=web&password=" . $password . "&encoding=utf8&lang=all&site=fu-berlin.de&quicktips=off&out=results-with-style"; $link = "/meta/meta.ger3?eingabe=" . $request->input('eingabe') . " -host:userpage.fu-berlin.de&focus=web&password=" . $password . "&encoding=utf8&lang=all&site=fu-berlin.de&quicktips=off&out=results-with-style";
} }
return view('berlin') return view('berlin')
->with('title', 'Testseite für die FU-Berlin') ->with('title', 'Testseite für die FU-Berlin')
......
...@@ -98,8 +98,8 @@ class MetaGer ...@@ -98,8 +98,8 @@ class MetaGer
$focusPages = []; $focusPages = [];
foreach ($this->request->all() as $key => $value) { foreach ($this->request->all() as $key => $value) {
if ($value === 'on') { if (starts_with($key, 'engine_') && $value === 'on') {
$focusPages[] = str_replace('param_', '', str_replace('engine_', '', $key)); $focusPages[] = $key;
} }
} }
......
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
</div> </div>
<div class="search-option-frame hide-tooltip-on-resultpage" data-tooltip="@lang("index.focus-creator.head")"> <div class="search-option-frame hide-tooltip-on-resultpage" data-tooltip="@lang("index.focus-creator.head")">
<label class="navigation-element" for="show-create-focus"> <label class="navigation-element" for="show-create-focus">
<i class="fa fa-sliders"></i> <i class="fa fa-sliders-h"></i>
</label> </label>
</div> </div>
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
<input type="hidden" name="time" value={{ $time }}> <input type="hidden" name="time" value={{ $time }}>
@endif @endif
@if (isset($focusPages) && !empty($focusPages)) @if (isset($focusPages) && !empty($focusPages))
<input type="hidden" name="focus" value="focus_custom">
@foreach ($focusPages as $fp) @foreach ($focusPages as $fp)
<input type="hidden" name={{ $fp }} value="on"> <input type="hidden" name={{ $fp }} value="on">
@endforeach @endforeach
......
Supports Markdown
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