Commit 4c876f97 authored by Karl's avatar Karl
Browse files

Added fresh compilation of gulp files

parents 5d1c394c 13a67f62
......@@ -89,11 +89,7 @@ class MetaGerSearch extends Controller
# Wetter
try {
if (App::isLocale('en')) {
$url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=en&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap");
} else {
$url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=de&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap");
}
$url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=" . APP::getLocale() . "&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap");
$result = json_decode($this->get($url), true);
......@@ -133,11 +129,7 @@ class MetaGerSearch extends Controller
}
# Wikipedia Quicktip
if (App::isLocale('en')) {
$url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve";
} else {
$url = "https://de.wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve";
}
$url = "https://" . APP::getLocale() . ".wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve";
$decodedResponse = json_decode($this->get($url), true);
if (isset($decodedResponse[1][0]) && isset($decodedResponse[2][0]) && isset($decodedResponse[3][0])) {
$quicktip = [];
......
......@@ -21,7 +21,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') {
......@@ -42,7 +42,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;
......
......@@ -331,7 +331,17 @@ class MetaGer
public function doBotProtection($bot)
{
$hash = md5(date('YmdHi'));
if (preg_match("/^\d+$/s", $this->getEingabe()) && $bot !== $hash) {
$shouldCheck = false;
foreach ($this->request->all() as $key => $value) {
if (strpos($key, "amp;") !== false) {
$shouldCheck = true;
break;
}
}
if ((preg_match("/^\d+$/s", $this->getEingabe()) || $shouldCheck) && $bot !== $hash) {
return true;
} else {
return false;
......@@ -862,6 +872,10 @@ class MetaGer
$this->q = strtolower($this->eingabe);
# IP
$this->ip = $request->ip();
# Unser erster Schritt wird sein, IP-Adresse und USER-Agent zu anonymisieren, damit
# nicht einmal wir selbst noch Zugriff auf die Daten haben:
$this->ip = preg_replace("/(\d+)\.(\d+)\.\d+.\d+/s", "$1.$2.0.0", $this->ip);
# Language
if (isset($_SERVER['HTTP_LANGUAGE'])) {
$this->language = $_SERVER['HTTP_LANGUAGE'];
......@@ -896,8 +910,12 @@ class MetaGer
} else {
$this->maps = false;
}
<<<<<<< HEAD
# Neuer tab
$this->newtab = $request->input('tab', 'on');
=======
$this->newtab = $request->input('newtab', 'on');
>>>>>>> development
if ($this->newtab === "on") {
$this->newtab = "_blank";
} else {
......@@ -1076,7 +1094,10 @@ class MetaGer
public function nextSearchLink()
{
if (isset($this->next) && isset($this->next['engines']) && count($this->next['engines']) > 0) {
$requestData = $this->request->except(['page', 'out']);
$requestData = $this->request->except(['page', 'out']);
if ($this->request->input('out', '') !== "results" && $this->request->input('out', '') !== '') {
$requestData["out"] = $this->request->input('out');
}
$requestData['next'] = md5(serialize($this->next));
$link = action('MetaGerSearch@search', $requestData);
} else {
......@@ -1149,14 +1170,24 @@ class MetaGer
try
{
$logEntry = "";
$logEntry .= "[" . date(DATE_RFC822, mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"))) . "]";
$logEntry .= "[" . date("D M d H:i:s") . "]";
/*
Someone might wonder now why we are saving the IP-Adress to the log file here:
It's because we were targets of heavy Bot attacks which created so many Search-Request to our Servers that
not only our servers but the ones from some of our search engines too collapsed.
At that point we could'nt prevent the Bot from accessing our server because we would need it's IP-Adress to do so.
That's why we need to save the IP-Adress to our Log-Files temporarily. The logrotate process that shifts our Log-Files will then
automatically remove the IP-Adresses from the Log-File after a few hours.
This method gives us just enough time to prevent malicious Software from bringing our servers down and at the same time having not a single
IP-Adress older than one day stored on our servers. (Except the ones who got banned in that short period of course) ;-)
*/
$logEntry .= " ip=" . $this->request->ip();
$logEntry .= " pid=" . getmypid();
$logEntry .= " ref=" . $this->request->header('Referer');
$useragent = $this->request->header('User-Agent');
$useragent = str_replace("(", " ", $useragent);
$useragent = str_replace(")", " ", $useragent);
$useragent = str_replace(" ", "", $useragent);
$logEntry .= " time=" . round((microtime(true) - $this->starttime), 2) . " serv=" . $this->fokus;
$logEntry .= " interface=" . LaravelLocalization::getCurrentLocale();
$logEntry .= " sprachfilter=" . $this->lang;
$logEntry .= " search=" . $this->eingabe;
# 2 Arten von Logs in einem wird die Anzahl der Abfragen an eine Suchmaschine gespeichert und in der anderen
......
......@@ -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)
{
......@@ -279,8 +317,14 @@ class Result
$tmp = $link;
$tmp = preg_replace("/\r?\n$/s", "", $tmp);
$tmp = str_replace("=", "=3d", $tmp);
$tmp = str_replace("?", "=3f", $tmp);
$tmp = str_replace("%", "=25", $tmp);
$tmp = str_replace("&", "=26", $tmp);
$tmp = str_replace(";", "=3b", $tmp);
$tmp = preg_replace("#^([\w+.-]+)://#s", "$1/", $tmp);
return "https://proxy.suma-ev.de/cgi-bin/nph-proxy.cgi/en/I0/" . $tmp;
$tmp = str_replace("//", "/=2f", $tmp);
return "https://proxy.suma-ev.de/mger/nph-proxy.cgi/en/w0/" . $tmp;
}
......
......@@ -80,17 +80,24 @@ class Overture extends Searchengine
return;
}
# Auslesen der Argumente für die nächste Suchseite:
$result = preg_replace("/\r\n/si", "", $result);
try {
$content = simplexml_load_string($result);
} catch (\Exception $e) {
Log::error("Results from $this->name are not a valid json string");
if (!$content) {
return;
}
if (!$content) {
// Yahoo liefert, wenn es keine weiteren Ergebnisse hat immer wieder die gleichen Ergebnisse
// Wir müssen also überprüfen, ob wir am Ende der Ergebnisse sind
$resultCount = $content->xpath('//Results/ResultSet[@id="inktomi"]/MetaData/TotalHits');
$results = $content->xpath('//Results/ResultSet[@id="inktomi"]/Listing');
if (isset($resultCount[0]) && sizeof($results) > 0) {
$resultCount = intval($resultCount[0]->__toString());
$lastResultOnPage = intval($results[sizeof($results) - 1]["rank"]);
if ($resultCount <= $lastResultOnPage) {
return;
}
} else {
return;
}
$nextArgs = $content->xpath('//Results/NextArgs');
if (isset($nextArgs[0])) {
$nextArgs = $nextArgs[0]->__toString();
......
......@@ -6782,6 +6782,23 @@ By ID
font-size: 16px;
font-family: Georgia, "Times New Roman", Palatino, Times, serif;
}
li#gutscheine.dropdown:hover ul.dropdown-menu {
display: block;
margin-top: 0px;
}
li#gutscheine > span {
padding-top: 15px!important;
padding-bottom: 15px!important;
position: relative;
display: block;
padding: 10px 15px;
color: #777;
line-height: 20px;
}
li#gutscheine > span a {
text-decoration: none;
color: #777;
}
/*
......@@ -7482,9 +7499,6 @@ a:hover {
overflow: hidden;
text-overflow: ellipsis;
}
.result.ad .title {
color: green;
}
.result .link {
font-size: 13px;
margin: 0;
......@@ -7497,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 {
......@@ -7542,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 {
......@@ -7616,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.
This diff is collapsed.
{
"css/themes/default.css": "css/themes/default-3d930e48d2.css",
"css/themes/default.css": "css/themes/default-46073189e4.css",
"js/all.js": "js/all-5ecffcf961.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
......@@ -6782,6 +6782,23 @@ By ID
font-size: 16px;
font-family: Georgia, "Times New Roman", Palatino, Times, serif;
}
li#gutscheine.dropdown:hover ul.dropdown-menu {
display: block;
margin-top: 0px;
}
li#gutscheine > span {
padding-top: 15px!important;
padding-bottom: 15px!important;
position: relative;
display: block;
padding: 10px 15px;
color: #777;
line-height: 20px;
}
li#gutscheine > span a {
text-decoration: none;
color: #777;
}
/*
......@@ -7482,9 +7499,6 @@ a:hover {
overflow: hidden;
text-overflow: ellipsis;
}
.result.ad .title {
color: green;
}
.result .link {
font-size: 13px;
margin: 0;
......@@ -7497,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 {
......@@ -7542,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 {
......@@ -7616,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.
......@@ -13,13 +13,6 @@ if (isset($_SERVER["HTTP_FORWARDED"]) && isset($_SERVER["HTTP_X_FORWARDED_FOR"])
unset($_SERVER["HTTP_FORWARDED"]);
}
# Unser erster Schritt wird sein, IP-Adresse und USER-Agent zu anonymisieren, damit
# nicht einmal wir selbst noch Zugriff auf die Daten haben:
if (!isset($_SERVER['HTTP_X_FORWARDED_FOR']) && isset($_SERVER['REMOTE_ADDR'])) {
$_SERVER['REMOTE_ADDR'] = preg_replace("/(\d+)\.(\d+)\.\d+.\d+/s", "$1.$2.0.0", $_SERVER['REMOTE_ADDR']);
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$_SERVER['HTTP_X_FORWARDED_FOR'] = preg_replace("/(\d+)\.(\d+)\.\d+.\d+/s", "$1.$2.0.0", $_SERVER['HTTP_X_FORWARDED_FOR']);
}
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$agentPieces = explode(" ", $_SERVER['HTTP_USER_AGENT']);
......
......@@ -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 */