diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 20a50f8be6d52d14d0ad9fdd765cc4eae0b88457..553332b4f20f471a92150fe75cc236ab0cd446c2 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -44,7 +44,7 @@ class MetaGerSearch extends Controller # Zunächst den Spruch $spruecheFile = storage_path() . "/app/public/sprueche.txt"; - if( file_exists($spruecheFile) && $_GET['sprueche']) + if( file_exists($spruecheFile) && $request->has('sprueche') ) { $sprueche = file($spruecheFile); $spruch = $sprueche[array_rand($sprueche)]; diff --git a/app/Models/Result.php b/app/Models/Result.php index 65e4ffa8f911302e6cc92f4a889e91e8ad626f97..85b946ae4dd4df38d6ebaa19112ab0c9d2411630 100644 --- a/app/Models/Result.php +++ b/app/Models/Result.php @@ -81,6 +81,8 @@ class Result #die($tmpLi . "<br>" . $link . "<br>" . $tmpEingabe . "<br><br>"); foreach(str_split($tmpEingabe) as $char) { + if( !$char || !$tmpEingabe || strlen($tmpEingabe) === 0 || strlen($char) === 0 ) + continue; if(strpos(strtolower($tmpLink), strtolower($char)) >= 0) { $count++; diff --git a/app/Models/parserSkripte/Minisucher.php b/app/Models/parserSkripte/Minisucher.php index f7838b814c11a3830468653ea66af56a94f73db6..2b42f8dca3322814bd4cddd803aebfada4b8ec3a 100644 --- a/app/Models/parserSkripte/Minisucher.php +++ b/app/Models/parserSkripte/Minisucher.php @@ -30,28 +30,33 @@ class Minisucher extends Searchengine $counter = 0; foreach($results as $result) { - $counter++; - $result = simplexml_load_string($result->saveXML()); - $title = $result->xpath('//doc/arr[@name="title"]/str')[0]->__toString(); - $link = $result->xpath('//doc/str[@name="url"]')[0]->__toString(); - $anzeigeLink = $link; - $descr = ""; - $descriptions = $content->xpath("//response/lst[@name='highlighting']/lst[@name='$link']/arr[@name='content']/str"); - foreach($descriptions as $description) + try{ + $counter++; + $result = simplexml_load_string($result->saveXML()); + $title = $result->xpath('//doc/arr[@name="title"]/str')[0]->__toString(); + $link = $result->xpath('//doc/str[@name="url"]')[0]->__toString(); + $anzeigeLink = $link; + $descr = ""; + $descriptions = $content->xpath("//response/lst[@name='highlighting']/lst[@name='$link']/arr[@name='content']/str"); + foreach($descriptions as $description) + { + $descr .= $description->__toString(); + } + $descr = strip_tags($descr); + $provider = $result->xpath('//doc/str[@name="subcollection"]')[0]->__toString(); + $this->results[] = new \App\Models\Result( + $this->engine, + $title, + $link, + $link, + $descr, + $this->gefVon, + $counter + ); + }catch(\ErrorException $e) { - $descr .= $description->__toString(); + continue; } - $descr = strip_tags($descr); - $provider = $result->xpath('//doc/str[@name="subcollection"]')[0]->__toString(); - $this->results[] = new \App\Models\Result( - $this->engine, - $title, - $link, - $link, - $descr, - $this->gefVon, - $counter - ); }