Commit 440288f6 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

English version now uses Scopia

parent a4ce133c
......@@ -10,7 +10,7 @@ class FokiLoader
{
$sumaFile = "";
if (App::isLocale('en')) {
$sumaFile = config_path() . "/sumas.xml";
$sumaFile = config_path() . "/sumasEn.xml";
} else {
$sumaFile = config_path() . "/sumas.xml";
}
......
......@@ -5,8 +5,8 @@ namespace App\Http\Controllers;
use App;
use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
use Response;
use LaravelLocalization;
use Response;
class StartpageController extends Controller
{
......@@ -33,12 +33,12 @@ class StartpageController extends Controller
}
$autocomplete = 'on';
if(in_array('autocomplete', array_keys($option_values))) {
if (in_array('autocomplete', array_keys($option_values))) {
$autocomplete = $option_values['autocomplete'];
}
$lang = LaravelLocalization::getCurrentLocale();
if ($lang === 'de') {
if ($lang === 'de' || $lang === "en") {
$lang = 'all';
}
......
......@@ -34,6 +34,7 @@ class MetaGer
protected $warnings = [];
protected $errors = [];
protected $addedHosts = [];
protected $availableFoki = [];
protected $startCount = 0;
protected $canCache = false;
# Daten über die Abfrage$
......@@ -525,6 +526,20 @@ class MetaGer
$overtureEnabled = false;
$sumaCount = 0;
/*
* Erstellt eine Liste mit Foki, die verfügbar sind
*/
$this->availableFoki = [];
foreach ($sumas as $suma) {
$foki = explode(",", trim($suma["type"]));
foreach ($foki as $fokus) {
if (!empty($fokus)) {
$this->availableFoki[$fokus] = "available";
}
}
}
$isCustomSearch = $this->startsWith($this->fokus, 'focus_');
# Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt
......@@ -646,7 +661,7 @@ class MetaGer
public function sumaIsSelected($suma, $request, $custom)
{
if ($custom) {
if ($request->filled("engine_" . $suma["name"])) {
if ($request->filled("engine_" . strtolower($suma["name"]))) {
return true;
}
} else {
......@@ -950,7 +965,7 @@ class MetaGer
$this->fokus = $request->input('focus', 'web');
# Suma-File
if (App::isLocale("en")) {
$this->sumaFile = config_path() . "/sumas.xml";
$this->sumaFile = config_path() . "/sumasEn.xml";
} else {
$this->sumaFile = config_path() . "/sumas.xml";
}
......@@ -1561,6 +1576,12 @@ class MetaGer
return $this->lang;
}
public function getAvailableFoki()
{
return $this->availableFoki;
}
public function getSprueche()
{
return $this->sprueche;
......
......@@ -31,6 +31,9 @@ abstract class Searchengine
public $startTime; # Die Zeit der Erstellung dieser Suchmaschine
public $hash; # Der Hash-Wert dieser Suchmaschine
private $user; # Username für HTTP-Auth (falls angegeben)
private $password; # Passwort für HTTP-Auth (falls angegeben)
public $fp; # Wird für Artefakte benötigt
public $socketNumber = null; # Wird für Artefakte benötigt
public $counter = 0; # Wird eventuell für Artefakte benötigt
......
......@@ -36,7 +36,8 @@ class Overture extends Searchengine
$link,
$anzeigeLink,
$descr,
$this->displayName,$this->homepage,
$this->displayName,
$this->homepage,
$this->counter
);
}
......@@ -55,7 +56,7 @@ class Overture extends Searchengine
$link,
$anzeigeLink,
$descr,
$this->displayName,$this->homepage,
$this->displayName, $this->homepage,
$this->counter
);
}
......
......@@ -17,7 +17,10 @@ class Scopia extends Searchengine
public function loadResults($result)
{
$result = html_entity_decode($result);
$result = str_replace("&", "&", $result);
$result = preg_replace("/<description>(.*?)<\/description>/si", "<description><![CDATA[ $1 ]]></description>", $result);
$result = preg_replace("/<title>(.*?)<\/title>/si", "<title><![CDATA[ $1 ]]></title>", $result);
$result = preg_replace("/<url>(.*?)<\/url>/si", "<url><![CDATA[ $1 ]]></url>", $result);
try {
$content = simplexml_load_string($result);
......@@ -38,7 +41,8 @@ class Scopia extends Searchengine
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->displayName,
$this->homepage,
$this->counter
);
}
......
@if( array_has($metager->getAvailableFoki(), "web"))
<div id="web" @if($metager->getFokus() === "web")class="active"@endif>
<a href="@if($metager->getFokus() === "web")#@else{!!$metager->generateSearchLink('web')!!}@endif" target="_self" tabindex="2">@lang('index.foki.web')</a>
</div>
@endif
@if( array_has($metager->getAvailableFoki(), "nachrichten"))
<div id="nachrichten" @if($metager->getFokus() === "nachrichten")class="active"@endif>
<a href="@if($metager->getFokus() === "nachrichten")#@else{!!$metager->generateSearchLink('nachrichten')!!}@endif" target="_self" tabindex="3">@lang('index.foki.nachrichten')</a>
</div>
@endif
@if( array_has($metager->getAvailableFoki(), "wissenschaft"))
<div id="wissenschaft" @if($metager->getFokus() === "wissenschaft")class="active"@endif>
<a href="@if($metager->getFokus() === "wissenschaft")#@else{!!$metager->generateSearchLink('wissenschaft')!!}@endif" target="_self" tabindex="4">@lang('index.foki.wissenschaft')</a>
</div>
@endif
@if( array_has($metager->getAvailableFoki(), "produktsuche"))
<div id="produkte" @if($metager->getFokus() === "produktsuche")class="active"@endif>
<a href="@if($metager->getFokus() === "produktsuche")#@else{!!$metager->generateSearchLink('produktsuche')!!}@endif" target="_self" tabindex="5">@lang('index.foki.produkte')</a>
</div>
@endif
<div id="maps">
<a href="https://maps.metager.de/map/{{ $metager->getQ() }}/9.7380161,52.37119740000003,12" target="_self" tabindex="6">@lang('index.foki.maps')</a>
</div>
......
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