diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 553332b4f20f471a92150fe75cc236ab0cd446c2..48a24e206e5b5e5f9eb7e01378254a5a31e57fa3 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -85,17 +85,20 @@ class MetaGerSearch extends Controller $quicktips = []; $url = "http://de.wikipedia.org/w/api.php?action=query&titles=".urlencode(implode("_",array_diff(explode(" ",$q),array("wikipedia"))))."&prop=info|extracts|categories&inprop=url|displaytitle&exintro&exsentences=3&format=json"; $decodedResponse = json_decode($this->get($url), true); - foreach($decodedResponse["query"]["pages"] as $result) + if( isset($decodedResponse["query"]["pages"]) ) { - if( isset($result['displaytitle']) && isset($result['fullurl']) && isset($result['extract']) ) + foreach($decodedResponse["query"]["pages"] as $result) { - $quicktip = []; - $quicktip["title"] = $result['displaytitle']; - $quicktip["URL"] = $result['fullurl']; - $quicktip["descr"] = strip_tags($result['extract']); - $quicktip['gefVon'] = "aus <a href=\"https://de.wikipedia.org\" target=\"_blank\">Wikipedia, der freien Enzyklopädie</a>"; - - $quicktips[] = $quicktip; + if( isset($result['displaytitle']) && isset($result['fullurl']) && isset($result['extract']) ) + { + $quicktip = []; + $quicktip["title"] = $result['displaytitle']; + $quicktip["URL"] = $result['fullurl']; + $quicktip["descr"] = strip_tags($result['extract']); + $quicktip['gefVon'] = "aus <a href=\"https://de.wikipedia.org\" target=\"_blank\">Wikipedia, der freien Enzyklopädie</a>"; + + $quicktips[] = $quicktip; + } } } $mquicktips = array_merge($mquicktips, $quicktips); diff --git a/app/MetaGer.php b/app/MetaGer.php index 0498741cd20295b83ae0d7cef5ac1ea2c836e621..62ab2eef16868921ed25506a8d1ead6023006295 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -282,7 +282,9 @@ class MetaGer public function createSearchEngines (Request $request) { - #die(SocketRocket::get("tls", "dominik-pfennig.de", "", 443)); + + if( !$request->has("eingabe") ) + return; # Überprüfe, welche Sumas eingeschaltet sind $xml = simplexml_load_file($this->sumaFile); @@ -341,7 +343,7 @@ class MetaGer } } } - + #die("test"); if( $countSumas <= 0 ) { $this->errors[] = "Achtung: Sie haben in ihren Einstellungen keine Suchmaschine ausgewählt."; diff --git a/app/Models/parserSkripte/Bing.php b/app/Models/parserSkripte/Bing.php index 872aa4b66fa42f143d8014d9c6a4e1e2f0d59fb7..74732ae86ac3c0e4c7a465218e289a89a29c8051 100644 --- a/app/Models/parserSkripte/Bing.php +++ b/app/Models/parserSkripte/Bing.php @@ -16,27 +16,33 @@ class Bing extends Searchengine public function loadResults ($result) { - $crawler = new Crawler($result); - $crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i) + try { - $title = $node->filter('li h2 > a')->text(); - $link = $node->filter('li h2 > a')->attr('href'); - $anzeigeLink = $link; - $descr = $node->filter('li div > p')->text(); - - #die($result); - - $this->counter++; - $this->results[] = new \App\Models\Result( - $this->engine, - $title, - $link, - $anzeigeLink, - $descr, - $this->gefVon, - $this->counter - ); - } ); + $crawler = new Crawler($result); + $crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i) + { + $title = $node->filter('li h2 > a')->text(); + $link = $node->filter('li h2 > a')->attr('href'); + $anzeigeLink = $link; + $descr = $node->filter('li div > p')->text(); + + #die($result); + + $this->counter++; + $this->results[] = new \App\Models\Result( + $this->engine, + $title, + $link, + $anzeigeLink, + $descr, + $this->gefVon, + $this->counter + ); + } ); + } catch ( \ErrorException $e) + { + return; + } diff --git a/resources/views/layouts/researchandtabs.blade.php b/resources/views/layouts/researchandtabs.blade.php index 5fd584522a143c0a45cafad28ac4dffdffceb409..2ee981228f3eade5de98c12478c2672d48079357 100644 --- a/resources/views/layouts/researchandtabs.blade.php +++ b/resources/views/layouts/researchandtabs.blade.php @@ -13,7 +13,7 @@ <li class="pull-right"> <form method="get" accept-charset="UTF-8" class="form" id="submitForm"> <div class="input-group"> - <input autocomplete="off" class="form-control" form="submitForm" id="eingabeTop" name="eingabe" placeholder="Suchbegriffe erweitern/verändern, oder völlig neue Suche:" tabindex="1" type="text" value="{{ $eingabe }}" /> + <input autocomplete="off" class="form-control" form="submitForm" id="eingabeTop" name="eingabe" placeholder="Suchbegriffe erweitern/verändern, oder völlig neue Suche:" tabindex="1" type="text" value="{{ $eingabe }}" required /> <div class="input-group-addon"> <button type='submit' form="submitForm" id='search'><span class="glyphicon glyphicon-search"></span> </button>