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

Merge branch 'Bugfix' into 'master'

Bugfix



See merge request !125
parents db8653e8 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
$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);
......
......@@ -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.";
......
......@@ -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;
}
......
......@@ -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>
......
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