Commit 4c32ab27 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch 'development' of https://gitlab.metager3.de/open-source/MetaGer into development

parents ddd71fca 9dba2a94
......@@ -28,7 +28,7 @@ class StartpageController extends Controller
$focusPages = [];
$theme = "default";
foreach ($request->all() as $key => $value) {
if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab' && $key !== 'param_maps' && $key !== 'param_autocomplete') {
if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_newtab' && $key !== 'param_maps' && $key !== 'param_autocomplete') {
$focusPages[] = str_replace('param_', '', $key);
}
if ($key === 'param_theme') {
......@@ -49,7 +49,7 @@ class StartpageController extends Controller
->with('resultCount', $request->input('param_resultCount', '20'))
->with('time', $request->input('param_time', '1000'))
->with('sprueche', $request->input('param_sprueche', 'off'))
->with('tab', $request->input('param_tab', 'off'))
->with('newtab', $request->input('param_newtab', 'on'))
->with('focusPages', $focusPages)
->with('browser', $browser)
->with('navbarFocus', 'suche')
......
......@@ -89,7 +89,9 @@ class Search implements ShouldQueue
}
$bodySize = strlen($body);
} else {
} elseif (isset($headers["connection"]) && strtolower($headers["connection"]) === "close") {
$body = $this->readUntilClose();
}else {
exit;
}
} else {
......@@ -103,6 +105,20 @@ class Search implements ShouldQueue
Redis::hset('search.' . $this->hash, $this->name, $body);
Redis::expire('search.' . $this->hash, 5);
}
private function readUntilClose()
{
$data = '';
stream_set_blocking($this->fp, 1);
while (!feof($this->fp)) {
$data .= fgets($this->fp, 8192);
}
# Bei dieser Funktion unterstützt der Host kein Keep-Alive:
# Wir beenden die Verbindung:
fclose($this->fp);
Redis::del($this->host . "." . $this->socketNumber);
return $data;
}
private function readBody($length)
{
......@@ -228,7 +244,7 @@ class Search implements ShouldQueue
$time = microtime(true);
while (true) {
$timeElapsed = microtime(true) - $time;
if ($timeElapsed > 0.5) {
if ($timeElapsed > 1.0) {
# Irgendwas ist mit unserem Socket passiert. Wir brauchen einen neuen:
if ($this->fp && is_resource($this->fp)) {
fclose($this->fp);
......@@ -238,7 +254,7 @@ class Search implements ShouldQueue
$this->fp = $this->getFreeSocket();
$sent = 0;
$string = $out;
break;
continue;
}
try {
$tmp = fwrite($this->fp, $string);
......@@ -304,7 +320,8 @@ class Search implements ShouldQueue
if ($this->fp && is_resource($this->fp)) {
fclose($fp);
}
$this->socketNumber = null;
Redis::del($this->host . ".$counter");
continue;
}
break;
......
......@@ -498,25 +498,40 @@ class MetaGer
$subcollections = [];
$tmp = [];
foreach ($enabledSearchengines as $engine) {
if (isset($engine['minismCollection'])) {
$subcollections[] = $engine['minismCollection']->__toString();
} else {
$tmp[] = $engine;
// Es gibt den Schalter "minism=on" Dieser soll bewirken, dass alle Minisucher angeschaltet werden.
// Wenn also "minism=on" ist, dann durchsuchen wir statt den tatsächlich angeschalteten Suchmaschinen,
// alle Suchmaschinen nach "minismCollection"
if ($request->input("minism", "off") === "on") {
// Wir laden alle Minisucher
foreach ($sumas as $engine) {
if (isset($engine["minismCollection"])) {
$subcollections[] = $engine["minismCollection"]->__toString();
}
}
# Nur noch alle eventuell angeschalteten Minisucher deaktivieren
foreach ($enabledSearchengines as $index => $engine) {
if (!isset($engine["minismCollection"])) {
$tmp[] = $engine;
}
}
} else {
// Wir schalten eine Teilmenge, oder aber gar keine an
foreach ($enabledSearchengines as $engine) {
if (isset($engine['minismCollection'])) {
$subcollections[] = $engine['minismCollection']->__toString();
} else {
$tmp[] = $engine;
}
}
}
$enabledSearchengines = $tmp;
if (sizeof($subcollections) > 0) {
$enabledSearchengines[] = $this->loadMiniSucher($xml, $subcollections);
}
if ($sumaCount <= 0) {
$this->errors[] = trans('metaGer.settings.noneSelected');
}
$engines = [];
# Wenn eine Sitesearch durchgeführt werden soll, überprüfen wir ob überhaupt eine der Suchmaschinen eine Sitesearch unterstützt
$siteSearchFailed = $this->checkCanNotSitesearch($enabledSearchengines);
......@@ -590,6 +605,9 @@ class MetaGer
continue;
}
if (!isset($engine["package"])) {
die(var_dump($engine));
}
# Setze Pfad zu Parser
$path = "App\Models\parserSkripte\\" . ucfirst($engine["package"]->__toString());
......@@ -908,7 +926,7 @@ class MetaGer
} else {
$this->maps = false;
}
$this->newtab = $request->input('tab', 'on');
$this->newtab = $request->input('newtab', 'on');
if ($this->newtab === "on") {
$this->newtab = "_blank";
} else {
......
......@@ -87,9 +87,47 @@ class Result
$rank *= floatval($this->engineBoost);
}
# Runter Ranken von Yandex Ergebnissen mit zu viel kyrillischen Texten
if (stripos($this->gefVon, "yandex") !== false) {
$rank -= $this->calcYandexBoost($eingabe);
}
$this->rank = $rank;
}
# Berechnet, ob dieses Suchergebnis einen Malus erhalten soll, oder nicht
# Übergeben werden alle Yandex Ergebnisse
# Wenn die Suchworte kein kyrillisches Zeichen enthalten, wird das Ergebnis schlechter bewertet,
# falls es selbst zu viele kyrillische Zeichen enthält
private function calcYandexBoost($tmpEingabe)
{
$maxRatio = 0.1; # Gibt den Prozentsatz von Kyrillischen Zeichen in Titel und Beschreibung an, ab dem das Ergebnis runter gerankt werden soll
if (preg_match('/[А-Яа-яЁё]/u', $tmpEingabe) === 1) {
# Das Suchwort enthält kyrillische Zeichen, also dürfen es auch die Ergebnisse
return 0;
} else {
# Wir überprüfen das Verhältnis von Kyrillischen Zeichen im Titel
if (preg_match_all('/[А-Яа-яЁё]/u', $this->titel, $matches)) {
$count = sizeof($matches[0]);
$titleSize = strlen($this->titel);
$percKyr = $count / $titleSize;
if ($percKyr > $maxRatio) {
return 5;
}
}
# Wir überprüfen das Verhältnis von Kyrillischen Zeichen in der Beschreibung
if (preg_match_all('/[А-Яа-яЁё]/u', $this->descr, $matches)) {
$count = sizeof($matches[0]);
$descrSize = strlen($this->descr);
$percKyr = $count / $descrSize;
if ($percKyr > $maxRatio) {
return 5;
}
}
}
return 0;
}
# Berechnet den Ranking-Boost durch ??? URL
public function calcURLBoost($tmpEingabe)
{
......@@ -285,6 +323,7 @@ class Result
$tmp = str_replace("&", "=26", $tmp);
$tmp = str_replace(";", "=3b", $tmp);
$tmp = preg_replace("#^([\w+.-]+)://#s", "$1/", $tmp);
$tmp = str_replace("//", "/=2f", $tmp);
return "https://proxy.suma-ev.de/mger/nph-proxy.cgi/en/w0/" . $tmp;
}
......
......@@ -55,8 +55,7 @@ class BASE extends Searchengine
}
}
} catch (\Exception $e) {
Log::error("A problem occurred parsing results from $this->name:");
Log::error($e->getMessage());
Log::error("A problem occurred parsing results from $this->name:\n" . $e->getMessage() . "\n" . $result);
return;
}
}
......
......@@ -22,10 +22,10 @@ class Nebel extends Searchengine
continue;
}
$title = $res[2];
$title = $res[1];
$link = $res[0];
$anzeigeLink = $link;
$descr = $res[1];
$descr = $res[2];
$this->counter++;
$this->results[] = new \App\Models\Result(
......
......@@ -4,7 +4,7 @@ namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class Opencrawltauchen extends Searchengine
class Opencrawlpolitik extends Searchengine
{
public $results = [];
......@@ -32,7 +32,7 @@ class Opencrawltauchen extends Searchengine
$title = $result->{"title"}->__toString();
$link = $result->{"link"}->__toString();
$anzeigeLink = $link;
$descr = strip_tags($result->{"description"}->__toString());
$descr = strip_tags(htmlspecialchars_decode($result->{"description"}->__toString()));
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
......
......@@ -44,8 +44,7 @@ class Yandex extends Searchengine
);
}
} catch (\Exception $e) {
Log::error("A problem occurred parsing results from $this->name:");
Log::error($e->getMessage());
Log::error("A problem occurred parsing results from $this->name:\n" . $e->getMessage() . "\n" . $result);
return;
}
}
......@@ -58,8 +57,11 @@ class Yandex extends Searchengine
if (!$content) {
return;
}
$resultCount = intval($content->xpath('//yandexsearch/response/results/grouping/found[@priority="all"]')[0]->__toString());
$resultCount = $content->xpath('//yandexsearch/response/results/grouping/found[@priority="all"]');
if(!$resultCount || sizeof($resultCount) <= 0){
return;
}
$resultCount = intval($resultCount[0]->__toString());
$pageLast = $content->xpath('//yandexsearch/response/results/grouping/page')[0];
$pageLast = intval($pageLast["last"]->__toString());
if (count($this->results) <= 0 || $pageLast >= $resultCount) {
......@@ -69,8 +71,7 @@ class Yandex extends Searchengine
$next->getString .= "&page=" . ($metager->getPage() + 1);
$next->hash = md5($next->host . $next->getString . $next->port . $next->name);
} catch (\Exception $e) {
Log::error("A problem occurred parsing results from $this->name:");
Log::error($e->getMessage());
Log::error("A problem occurred parsing results from $this->name:\n" . $e->getMessage() . "\n" . $result);
return;
}
}
......
......@@ -7499,9 +7499,6 @@ a:hover {
overflow: hidden;
text-overflow: ellipsis;
}
.result.ad .title {
color: green;
}
.result .link {
font-size: 13px;
margin: 0;
......@@ -7514,28 +7511,28 @@ a:hover {
text-overflow: ellipsis;
float: left;
}
.result:not(.ad) .link > div {
.result .link > div {
white-space: nowrap;
}
.result:not(.ad) .link > span {
.result .link > span {
white-space: nowrap;
margin: 0 5px;
}
.result:not(.ad) .link .options {
.result .link .options {
color: #333;
float: left;
}
/*
.result:not(.ad) .link:hover {
.result .link:hover {
cursor: pointer;
}*/
.result:not(.ad) .link .options > a {
.result .link .options > a {
color: #333;
display: block;
padding-left: 5px;
padding-right: 5px;
}
.result:not(.ad) .link .options > a > span {
.result .link .options > a > span {
font-size: 10px;
}
.result .description {
......@@ -7559,20 +7556,19 @@ a:hover {
max-height: 200px;
}
.result.ad .description {
color: green;
max-width: 115ch;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.result:not(.ad) .hoster {
.result .hoster {
font-size: 13px;
margin: 0;
color: #777;
margin-right: 10px;
white-space: nowrap;
}
.result:not(.ad) .hoster a {
.result .hoster a {
color: #333;
}
.result .result-image > img {
......@@ -7633,10 +7629,6 @@ a:hover {
#container {
margin: 10px auto;
}
/* Hier der Style für die Werbeboxen */
.result.ad .hoster {
color: green;
}
/* Style für den Footer */
footer {
text-align: center;
......
This diff is collapsed.
{
"css/themes/default.css": "css/themes/default-ef680128e7.css",
"css/themes/default.css": "css/themes/default-932aa22ca4.css",
"js/all.js": "js/all-70e38f5f5e.js",
"js/quicktips.js": "js/quicktips-34d41bc58a.js"
}
\ No newline at end of file
......@@ -55,6 +55,11 @@ input[type=text]:focus, textarea:focus, input[type=email]:focus, input[type=tel]
box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.2);
}
.navbar.navbar-resultpage {
border-bottom: 2px solid <?=$color?>;
box-shadow: none;
}
.lSPrev > span, .lSNext > span {
color: <?=$color?>;
}
\ No newline at end of file
......@@ -7499,9 +7499,6 @@ a:hover {
overflow: hidden;
text-overflow: ellipsis;
}
.result.ad .title {
color: green;
}
.result .link {
font-size: 13px;
margin: 0;
......@@ -7514,28 +7511,28 @@ a:hover {
text-overflow: ellipsis;
float: left;
}
.result:not(.ad) .link > div {
.result .link > div {
white-space: nowrap;
}
.result:not(.ad) .link > span {
.result .link > span {
white-space: nowrap;
margin: 0 5px;
}
.result:not(.ad) .link .options {
.result .link .options {
color: #333;
float: left;
}
/*
.result:not(.ad) .link:hover {
.result .link:hover {
cursor: pointer;
}*/
.result:not(.ad) .link .options > a {
.result .link .options > a {
color: #333;
display: block;
padding-left: 5px;
padding-right: 5px;
}
.result:not(.ad) .link .options > a > span {
.result .link .options > a > span {
font-size: 10px;
}
.result .description {
......@@ -7559,20 +7556,19 @@ a:hover {
max-height: 200px;
}
.result.ad .description {
color: green;
max-width: 115ch;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.result:not(.ad) .hoster {
.result .hoster {
font-size: 13px;
margin: 0;
color: #777;
margin-right: 10px;
white-space: nowrap;
}
.result:not(.ad) .hoster a {
.result .hoster a {
color: #333;
}
.result .result-image > img {
......@@ -7633,10 +7629,6 @@ a:hover {
#container {
margin: 10px auto;
}
/* Hier der Style für die Werbeboxen */
.result.ad .hoster {
color: green;
}
/* Style für den Footer */
footer {
text-align: center;
......
This diff is collapsed.
......@@ -265,10 +265,6 @@ a:hover {
text-overflow: ellipsis;
}
.result.ad .title {
color: green;
}
.result .link {
font-size: 13px;
margin: 0;
......@@ -283,33 +279,33 @@ a:hover {
float: left;
}
.result:not(.ad) .link > div {
.result .link > div {
white-space: nowrap;
}
.result:not(.ad) .link > span {
.result .link > span {
white-space: nowrap;
margin: 0 5px;
}
.result:not(.ad) .link .options {
.result .link .options {
color: #333;
float: left;
}
/*
.result:not(.ad) .link:hover {
.result .link:hover {
cursor: pointer;
}*/
.result:not(.ad) .link .options > a {
.result .link .options > a {
color: #333;
display: block;
padding-left: 5px;
padding-right: 5px;
}
.result:not(.ad) .link .options > a > span {
.result .link .options > a > span {
font-size: 10px;
}
......@@ -337,14 +333,13 @@ a:hover {
}
.result.ad .description {
color: green;
max-width: 115ch;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.result:not(.ad) .hoster {
.result .hoster {
font-size: 13px;
margin: 0;
color: #777;
......@@ -352,7 +347,7 @@ a:hover {
white-space: nowrap;
}
.result:not(.ad) .hoster a {
.result .hoster a {
color: #333;
}
......@@ -430,13 +425,6 @@ a:hover {
}
/* Hier der Style für die Werbeboxen */
.result.ad .hoster {
color: green;
}
/* Style für den Footer */
footer {
......
......@@ -3,7 +3,7 @@
return [
'foki.web' => 'Web',
'foki.bilder' => 'Bilder',
'foki.nachrichten' => 'Nachrichten',
'foki.nachrichten' => 'News/Politik',
'foki.wissenschaft' => 'Wissenschaft',
'foki.produkte' => 'Produkte',
'foki.anpassen' => 'anpassen',
......
......@@ -42,6 +42,6 @@ return [
"foki.andere" => "Andere",
"foki.produktsuche" => "Produktsuche",
"foki.wissenschaft" => "Wissenschaft",
"foki.nachrichten" => "Nachrichten",
"foki.nachrichten" => "News/Politik",
"foki.bilder" => "Bilder",
];
<?php
return [
"foki.web" => "Web",
"foki.bilder" => "Pictures",
"foki.nachrichten" => "News",
"foki.wissenschaft" => "Science",
"foki.produkte" => "Shopping",
"foki.anpassen" => "customize",
"foki.angepasst" => "customized",
"foki.maps" => "maps.metager.de <span class=\"badge new-feature\">New</span>",
"design" => "select personal theme",
"conveyor" => "Purchase at affiliate shops",
"partnertitle" => "Support MetaGer without any costs to you",
"plugin" => "Add MetaGer-Plugin",
"plugintitle" => "add MetaGer to your browser",
"sponsors.head.1" => "Further Information",
"sponsors.head.2" => "Protect Yourself",
"sponsors.woxikon" => "Use MetaGer against Snoopers:",
"sponsors.gutscheine" => "Click results by \"open anonymously\"",
"sponsors.kredite" => "and you are fully protected.",
"about.title" => "About Us",
"about.1.1" => "We provide <a href=\"/en/datenschutz\">privacy & data protection.</a>",
"about.2.1" => "We are a <a href=\"/en/spende\">non profit NGO</a>. <a href=\"https://gitlab.metager3.de/open-source/MetaGer\" target=\"_blank\">Our source code is open:</a>",
"about.3.1" => "Everyone might check our data protection & privacy features.",
"placeholder" => "MetaGer: Privacy Protected Search & Find",
"plugin.head.1" => "Add MetaGer to your Firefox",
"plugin.head.2" => "Add MetaGer to your Chrome",
"plugin.head.3" => "Add MetaGer to your Opera",
"plugin.head.4" => "Add MetaGer to your Internet Explorer",
"plugin.head.5" => "Add MetaGer to your Microsoft Edge",
"plugin.head.6" => "Add MetaGer to your Safari",
"plugin.head.info" => "(selected search preferences will be used)",
"plugin.firefox.1" => "Click on the magnifying glass with the small green \"+\" and then on \"Add MetaGer..\" (picture 1)",
"plugin.firefox.2" => "Now right click on the new MetaGer Logo in the List and select \"Make MetaGer the default search engine\" (picture2)",
"plugin.firefox.3" => "Use MetaGer as start page in :browser",
"plugin.firefox.4" => "Click top right in your browser on <span class=\"glyphicon glyphicon-menu-hamburger\" aria-hidden=\"true\"></span><span class=\"sr-only\">the three small horizontal lines</span> (menu) and open \"Preferences\"",
"plugin.firefox.5" => "Type in field \"Home Page\" => \"https://metager.de/en/\"",
"plugin.chrome.1" => "Click in your Chrome browser on <span class=\"glyphicon glyphicon-option-vertical\"></span> and in the next menu on \"Preferences\" to open the settings of your Chrome browser",
"plugin.chrome.2" => "Click in field \"Search\" on manage search engines",
"plugin.chrome.3" => "Now you will find an entry \"MetaGer\". Move your mouse over that entry and click on \"Standard\",",
"plugin.chrome.4" => "Set up MetaGer as start page in your browser",
"plugin.chrome.5" => "Click in your browser on<span class=\"glyphicon glyphicon-option-vertical\"></span> and open \"Preferences\"",
"plugin.chrome.6" => "In the field \"Start\" choose \"Open specific Page/s\" and then click on \"Choose Page/s\"",