Skip to content
Snippets Groups Projects
Commit bac29667 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch 'Bugfix' into 'development'

Bugfix



See merge request !124
parents 44f5f909 52821444
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
...@@ -85,17 +85,20 @@ class MetaGerSearch extends Controller ...@@ -85,17 +85,20 @@ class MetaGerSearch extends Controller
$quicktips = []; $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"; $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); $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 = []; if( isset($result['displaytitle']) && isset($result['fullurl']) && isset($result['extract']) )
$quicktip["title"] = $result['displaytitle']; {
$quicktip["URL"] = $result['fullurl']; $quicktip = [];
$quicktip["descr"] = strip_tags($result['extract']); $quicktip["title"] = $result['displaytitle'];
$quicktip['gefVon'] = "aus <a href=\"https://de.wikipedia.org\" target=\"_blank\">Wikipedia, der freien Enzyklopädie</a>"; $quicktip["URL"] = $result['fullurl'];
$quicktip["descr"] = strip_tags($result['extract']);
$quicktips[] = $quicktip; $quicktip['gefVon'] = "aus <a href=\"https://de.wikipedia.org\" target=\"_blank\">Wikipedia, der freien Enzyklopädie</a>";
$quicktips[] = $quicktip;
}
} }
} }
$mquicktips = array_merge($mquicktips, $quicktips); $mquicktips = array_merge($mquicktips, $quicktips);
......
...@@ -282,7 +282,9 @@ class MetaGer ...@@ -282,7 +282,9 @@ class MetaGer
public function createSearchEngines (Request $request) public function createSearchEngines (Request $request)
{ {
#die(SocketRocket::get("tls", "dominik-pfennig.de", "", 443));
if( !$request->has("eingabe") )
return;
# Überprüfe, welche Sumas eingeschaltet sind # Überprüfe, welche Sumas eingeschaltet sind
$xml = simplexml_load_file($this->sumaFile); $xml = simplexml_load_file($this->sumaFile);
...@@ -341,7 +343,7 @@ class MetaGer ...@@ -341,7 +343,7 @@ class MetaGer
} }
} }
} }
#die("test");
if( $countSumas <= 0 ) if( $countSumas <= 0 )
{ {
$this->errors[] = "Achtung: Sie haben in ihren Einstellungen keine Suchmaschine ausgewählt."; $this->errors[] = "Achtung: Sie haben in ihren Einstellungen keine Suchmaschine ausgewählt.";
......
...@@ -16,27 +16,33 @@ class Bing extends Searchengine ...@@ -16,27 +16,33 @@ class Bing extends Searchengine
public function loadResults ($result) public function loadResults ($result)
{ {
$crawler = new Crawler($result); try
$crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i)
{ {
$title = $node->filter('li h2 > a')->text(); $crawler = new Crawler($result);
$link = $node->filter('li h2 > a')->attr('href'); $crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i)
$anzeigeLink = $link; {
$descr = $node->filter('li div > p')->text(); $title = $node->filter('li h2 > a')->text();
$link = $node->filter('li h2 > a')->attr('href');
#die($result); $anzeigeLink = $link;
$descr = $node->filter('li div > p')->text();
$this->counter++;
$this->results[] = new \App\Models\Result( #die($result);
$this->engine,
$title, $this->counter++;
$link, $this->results[] = new \App\Models\Result(
$anzeigeLink, $this->engine,
$descr, $title,
$this->gefVon, $link,
$this->counter $anzeigeLink,
); $descr,
} ); $this->gefVon,
$this->counter
);
} );
} catch ( \ErrorException $e)
{
return;
}
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<li class="pull-right"> <li class="pull-right">
<form method="get" accept-charset="UTF-8" class="form" id="submitForm"> <form method="get" accept-charset="UTF-8" class="form" id="submitForm">
<div class="input-group"> <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"> <div class="input-group-addon">
<button type='submit' form="submitForm" id='search'><span class="glyphicon glyphicon-search"></span> <button type='submit' form="submitForm" id='search'><span class="glyphicon glyphicon-search"></span>
</button> </button>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment