Commit 4029df8f authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Die Blade Dateien der Ergebnisausgabe haben jetzt eine kürzere benennung

Einige Dinge wurden Zusammengefasst und Redundanzen entfernt
parent 33743bf9
...@@ -22,25 +22,25 @@ class MetaGer ...@@ -22,25 +22,25 @@ class MetaGer
protected $lang; protected $lang;
protected $cache = ""; protected $cache = "";
protected $site; protected $site;
protected $hostBlacklist = []; protected $hostBlacklist = [];
protected $domainBlacklist = []; protected $domainBlacklist = [];
private $urlBlacklist = []; private $urlBlacklist = [];
protected $stopWords = []; protected $stopWords = [];
protected $phrases = []; protected $phrases = [];
protected $engines = []; protected $engines = [];
protected $results = []; protected $results = [];
protected $ads = []; protected $ads = [];
protected $warnings = []; protected $warnings = [];
protected $errors = []; protected $errors = [];
protected $addedHosts = []; protected $addedHosts = [];
protected $startCount = 0; protected $startCount = 0;
protected $canCache = false; protected $canCache = false;
# Daten über die Abfrage$ # Daten über die Abfrage$
protected $ip; protected $ip;
protected $useragent; protected $useragent;
protected $language; protected $language;
protected $agent; protected $agent;
protected $apiKey = ""; protected $apiKey = "";
protected $apiAuthorized = false; protected $apiAuthorized = false;
# Konfigurationseinstellungen: # Konfigurationseinstellungen:
protected $sumaFile; protected $sumaFile;
...@@ -50,7 +50,7 @@ class MetaGer ...@@ -50,7 +50,7 @@ class MetaGer
protected $maps; protected $maps;
protected $newtab; protected $newtab;
protected $domainsBlacklisted = []; protected $domainsBlacklisted = [];
protected $urlsBlacklisted = []; protected $urlsBlacklisted = [];
protected $url; protected $url;
protected $languageDetect; protected $languageDetect;
...@@ -61,10 +61,10 @@ class MetaGer ...@@ -61,10 +61,10 @@ class MetaGer
# Versuchen Blacklists einzulesen # Versuchen Blacklists einzulesen
if (file_exists(config_path() . "/blacklistDomains.txt") && file_exists(config_path() . "/blacklistUrl.txt")) { if (file_exists(config_path() . "/blacklistDomains.txt") && file_exists(config_path() . "/blacklistUrl.txt")) {
$tmp = file_get_contents(config_path() . "/blacklistDomains.txt"); $tmp = file_get_contents(config_path() . "/blacklistDomains.txt");
$this->domainsBlacklisted = explode("\n", $tmp); $this->domainsBlacklisted = explode("\n", $tmp);
$tmp = file_get_contents(config_path() . "/blacklistUrl.txt"); $tmp = file_get_contents(config_path() . "/blacklistUrl.txt");
$this->urlsBlacklisted = explode("\n", $tmp); $this->urlsBlacklisted = explode("\n", $tmp);
} else { } else {
Log::warning("Achtung: Eine, oder mehrere Blacklist Dateien, konnten nicht geöffnet werden"); Log::warning("Achtung: Eine, oder mehrere Blacklist Dateien, konnten nicht geöffnet werden");
} }
...@@ -88,7 +88,7 @@ class MetaGer ...@@ -88,7 +88,7 @@ class MetaGer
} }
# Erstellt aus den gesammelten Ergebnissen den View # Erstellt aus den gesammelten Ergebnissen den View
public function createView($quicktipResults = NULL) public function createView($quicktipResults = null)
{ {
# Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können # Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können
$focusPages = []; $focusPages = [];
...@@ -109,7 +109,7 @@ class MetaGer ...@@ -109,7 +109,7 @@ class MetaGer
if ($this->fokus === "bilder") { if ($this->fokus === "bilder") {
switch ($this->out) { switch ($this->out) {
case 'results': case 'results':
return view('metager3bilderresults') return view('resultpages.results_images')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -119,7 +119,7 @@ class MetaGer ...@@ -119,7 +119,7 @@ class MetaGer
->with('metager', $this) ->with('metager', $this)
->with('browser', (new Agent())->browser()); ->with('browser', (new Agent())->browser());
default: default:
return view('metager3bilder') return view('resultpages.resultpage_images')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -132,7 +132,7 @@ class MetaGer ...@@ -132,7 +132,7 @@ class MetaGer
} else { } else {
switch ($this->out) { switch ($this->out) {
case 'results': case 'results':
return view('metager3results') return view('resultpages.results')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -144,7 +144,7 @@ class MetaGer ...@@ -144,7 +144,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'results-with-style': case 'results-with-style':
return view('metager3') return view('resultpages.resultpage')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -157,7 +157,7 @@ class MetaGer ...@@ -157,7 +157,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'rich': case 'rich':
return view('metager3rich') return view('resultpages.metager3rich')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -169,7 +169,7 @@ class MetaGer ...@@ -169,7 +169,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'rss20': case 'rss20':
return view('metager3resultsrss20') return view('resultpages.metager3resultsrss20')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('apiAuthorized', $this->apiAuthorized) ->with('apiAuthorized', $this->apiAuthorized)
...@@ -178,15 +178,15 @@ class MetaGer ...@@ -178,15 +178,15 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'atom10': case 'atom10':
return response()->view('metager3resultsatom10', ['results' => $viewResults,'eingabe' => $this->eingabe,'metager' => $this,'resultcount' => sizeof($viewResults)]) return response()->view('resultpages.metager3resultsatom10', ['results' => $viewResults, 'eingabe' => $this->eingabe, 'metager' => $this, 'resultcount' => sizeof($viewResults)])
->header('Content-Type', 'application/xml'); ->header('Content-Type', 'application/xml');
break; break;
case 'result-count': case 'result-count':
# Wir geben die Ergebniszahl und die benötigte Zeit zurück: # Wir geben die Ergebniszahl und die benötigte Zeit zurück:
return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2); return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2);
break; break;
default: default:
return view('metager3') return view('resultpages.resultpage')
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('focusPages', $focusPages) ->with('focusPages', $focusPages)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -252,7 +252,7 @@ class MetaGer ...@@ -252,7 +252,7 @@ class MetaGer
#Adgoal Implementation #Adgoal Implementation
$this->results = $this->parseAdgoal($this->results); $this->results = $this->parseAdgoal($this->results);
$counter = 0; $counter = 0;
$firstRank = 0; $firstRank = 0;
if (isset($this->startForwards)) { if (isset($this->startForwards)) {
...@@ -270,7 +270,7 @@ class MetaGer ...@@ -270,7 +270,7 @@ class MetaGer
$counter++; $counter++;
$result->number = $counter + $this->startCount; $result->number = $counter + $this->startCount;
$confidence = 0; $confidence = 0;
if ($firstRank > 0) { if ($firstRank > 0) {
$confidence = $result->rank / $firstRank; $confidence = $result->rank / $firstRank;
} else { } else {
...@@ -292,10 +292,10 @@ class MetaGer ...@@ -292,10 +292,10 @@ class MetaGer
if (LaravelLocalization::getCurrentLocale() === "en") { if (LaravelLocalization::getCurrentLocale() === "en") {
$this->ads = []; $this->ads = [];
} }
if ($this->validated) { if ($this->validated) {
$this->ads = []; $this->ads = [];
$this->maps = false; $this->maps = false;
} }
if (count($this->results) <= 0) { if (count($this->results) <= 0) {
...@@ -303,11 +303,11 @@ class MetaGer ...@@ -303,11 +303,11 @@ class MetaGer
} }
if ($this->canCache() && isset($this->next) && count($this->next) > 0 && count($this->results) > 0) { if ($this->canCache() && isset($this->next) && count($this->next) > 0 && count($this->results) > 0) {
$page = $this->page + 1; $page = $this->page + 1;
$this->next = [ $this->next = [
'page' => $page, 'page' => $page,
'startForwards' => $this->results[count($this->results) - 1]->number, 'startForwards' => $this->results[count($this->results) - 1]->number,
'engines' => $this->next, 'engines' => $this->next,
]; ];
Cache::put(md5(serialize($this->next)), serialize($this->next), 60); Cache::put(md5(serialize($this->next)), serialize($this->next), 60);
} else { } else {
...@@ -328,7 +328,7 @@ class MetaGer ...@@ -328,7 +328,7 @@ class MetaGer
return $results; return $results;
} else { } else {
# Ansonsten müssen wir jedem Result einen Sprachcode hinzufügen # Ansonsten müssen wir jedem Result einen Sprachcode hinzufügen
$id = 0; $id = 0;
$langStrings = []; $langStrings = [];
foreach ($results as $result) { foreach ($results as $result) {
# Wir geben jedem Ergebnis eine ID um später die Sprachcodes zuordnen zu können # Wir geben jedem Ergebnis eine ID um später die Sprachcodes zuordnen zu können
...@@ -343,8 +343,8 @@ class MetaGer ...@@ -343,8 +343,8 @@ class MetaGer
$filename = "/tmp/" . getmypid(); $filename = "/tmp/" . getmypid();
file_put_contents($filename, json_encode($langStrings)); file_put_contents($filename, json_encode($langStrings));
$langDetectorPath = app_path() . "/Models/lang.pl"; $langDetectorPath = app_path() . "/Models/lang.pl";
$lang = exec("echo '$filename' | $langDetectorPath"); $lang = exec("echo '$filename' | $langDetectorPath");
$lang = json_decode($lang, true); $lang = json_decode($lang, true);
# Wir haben nun die Sprachcodes der einzelnen Ergebnisse. # Wir haben nun die Sprachcodes der einzelnen Ergebnisse.
# Diese müssen wir nur noch korrekt zuordnen, dann sind wir fertig. # Diese müssen wir nur noch korrekt zuordnen, dann sind wir fertig.
...@@ -385,7 +385,7 @@ class MetaGer ...@@ -385,7 +385,7 @@ class MetaGer
public function parseAdgoal($results) public function parseAdgoal($results)
{ {
$publicKey = getenv('adgoal_public'); $publicKey = getenv('adgoal_public');
$privateKey = getenv('adgoal_private'); $privateKey = getenv('adgoal_private');
if ($publicKey === false) { if ($publicKey === false) {
return $results; return $results;
...@@ -408,13 +408,13 @@ class MetaGer ...@@ -408,13 +408,13 @@ class MetaGer
# Query # Query
$query = urlencode($this->q); $query = urlencode($this->q);
$link = "https://api.smartredirect.de/api_v2/CheckForAffiliateUniversalsearchMetager.php?p=" . $publicKey . "&k=" . $hash . "&tld=" . $tldList . "&q=" . $query; $link = "https://api.smartredirect.de/api_v2/CheckForAffiliateUniversalsearchMetager.php?p=" . $publicKey . "&k=" . $hash . "&tld=" . $tldList . "&q=" . $query;
$answer = json_decode(file_get_contents($link)); $answer = json_decode(file_get_contents($link));
# Nun müssen wir nur noch die Links für die Advertiser ändern: # Nun müssen wir nur noch die Links für die Advertiser ändern:
foreach ($answer as $el) { foreach ($answer as $el) {
$hoster = $el[0]; $hoster = $el[0];
$hash = $el[1]; $hash = $el[1];
foreach ($results as $result) { foreach ($results as $result) {
if ($hoster === $result->tld) { if ($hoster === $result->tld) {
...@@ -433,9 +433,9 @@ class MetaGer ...@@ -433,9 +433,9 @@ class MetaGer
$targetUrl = "http://" . $targetUrl; $targetUrl = "http://" . $targetUrl;
} }
$gateHash = md5($targetUrl . $privateKey); $gateHash = md5($targetUrl . $privateKey);
$newLink = "https://api.smartredirect.de/api_v2/ClickGate.php?p=" . $publicKey . "&k=" . $gateHash . "&url=" . urlencode($targetUrl) . "&q=" . $query; $newLink = "https://api.smartredirect.de/api_v2/ClickGate.php?p=" . $publicKey . "&k=" . $gateHash . "&url=" . urlencode($targetUrl) . "&q=" . $query;
$result->link = $newLink; $result->link = $newLink;
$result->partnershop = true; $result->partnershop = true;
} }
} }
...@@ -453,8 +453,8 @@ class MetaGer ...@@ -453,8 +453,8 @@ class MetaGer
'dummy' => rand(), 'dummy' => rand(),
)); ));
$opts = array('http' => array( $opts = array('http' => array(
'method' => 'POST', 'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded', 'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata, 'content' => $postdata,
), ),
); );
...@@ -462,7 +462,7 @@ class MetaGer ...@@ -462,7 +462,7 @@ class MetaGer
$context = stream_context_create($opts); $context = stream_context_create($opts);
try { try {
$link = "https://key.metager3.de/" . urlencode($key) . "/request-permission/api-access"; $link = "https://key.metager3.de/" . urlencode($key) . "/request-permission/api-access";
$result = json_decode(file_get_contents($link, false, $context)); $result = json_decode(file_get_contents($link, false, $context));
if ($result->{'api-access'} == true) { if ($result->{'api-access'} == true) {
return true; return true;
...@@ -475,7 +475,8 @@ class MetaGer ...@@ -475,7 +475,8 @@ class MetaGer
} }
} }
public function createQuicktips() { public function createQuicktips()
{
# Die quicktips werden als job erstellt und zur Abarbeitung freigegeben # Die quicktips werden als job erstellt und zur Abarbeitung freigegeben
$quicktips = new \App\Models\Quicktips\Quicktips($this->q, $this->lang, $this->getTime(), $this->getHashCode()); $quicktips = new \App\Models\Quicktips\Quicktips($this->q, $this->lang, $this->getTime(), $this->getHashCode());
return $quicktips; return $quicktips;
...@@ -492,16 +493,16 @@ class MetaGer ...@@ -492,16 +493,16 @@ class MetaGer
return; return;
} }
$xml = simplexml_load_file($this->sumaFile); $xml = simplexml_load_file($this->sumaFile);
$sumas = $xml->xpath("suma"); $sumas = $xml->xpath("suma");
$enabledSearchengines = []; $enabledSearchengines = [];
$overtureEnabled = false; $overtureEnabled = false;
$sumaCount = 0; $sumaCount = 0;
$isCustomSearch = $this->startsWith($this->fokus, 'focus_'); $isCustomSearch = $this->startsWith($this->fokus, 'focus_');
# Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt # Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt
if($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) { if ($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) {
$isCustomSearch = false; $isCustomSearch = false;
$this->fokus = 'web'; $this->fokus = 'web';
} }
...@@ -573,7 +574,7 @@ class MetaGer ...@@ -573,7 +574,7 @@ class MetaGer
$siteSearchFailed = $this->checkCanNotSitesearch($enabledSearchengines); $siteSearchFailed = $this->checkCanNotSitesearch($enabledSearchengines);
$typeslist = []; $typeslist = [];
$counter = 0; $counter = 0;
if ($this->requestIsCached($request)) { if ($this->requestIsCached($request)) {
$engines = $this->getCachedEngines($request); $engines = $this->getCachedEngines($request);
...@@ -598,7 +599,7 @@ class MetaGer ...@@ -598,7 +599,7 @@ class MetaGer
*/ */
$enginesToLoad = []; $enginesToLoad = [];
$canBreak = false; $canBreak = false;
foreach ($engines as $engine) { foreach ($engines as $engine) {
if ($engine->cached) { if ($engine->cached) {
if ($overtureEnabled && ($engine->name === "overture" || $engine->name === "overtureAds")) { if ($overtureEnabled && ($engine->name === "overture" || $engine->name === "overtureAds")) {
...@@ -725,9 +726,9 @@ class MetaGer ...@@ -725,9 +726,9 @@ class MetaGer
public function getCachedEngines($request) public function getCachedEngines($request)
{ {
$next = unserialize(Cache::get($request->input('next'))); $next = unserialize(Cache::get($request->input('next')));
$this->page = $next['page']; $this->page = $next['page'];
$engines = $next['engines']; $engines = $next['engines'];
if (isset($next['startForwards'])) { if (isset($next['startForwards'])) {
$this->startForwards = $next['startForwards']; $this->startForwards = $next['startForwards'];
} }
...@@ -739,9 +740,9 @@ class MetaGer ...@@ -739,9 +740,9 @@ class MetaGer
public function loadMiniSucher($xml, $subcollections) public function loadMiniSucher($xml, $subcollections)
{ {
$minisucherEngine = $xml->xpath('suma[@name="minism"]')[0]; $minisucherEngine = $xml->xpath('suma[@name="minism"]')[0];
$minisucherEngine["subcollections"] = implode(", ", $subcollections); $minisucherEngine["subcollections"] = implode(", ", $subcollections);
$subcollectionsString = urlencode("(" . implode(" OR ", $subcollections) . ")"); $subcollectionsString = urlencode("(" . implode(" OR ", $subcollections) . ")");
$minisucherEngine["formData"] = str_replace("<<SUBCOLLECTIONS>>", $subcollectionsString, $minisucherEngine["formData"]); $minisucherEngine["formData"] = str_replace("<<SUBCOLLECTIONS>>", $subcollectionsString, $minisucherEngine["formData"]);
$minisucherEngine["formData"] = str_replace("<<COUNT>>", sizeof($subcollections) * 10, $minisucherEngine["formData"]); $minisucherEngine["formData"] = str_replace("<<COUNT>>", sizeof($subcollections) * 10, $minisucherEngine["formData"]);
return $minisucherEngine; return $minisucherEngine;
...@@ -786,7 +787,7 @@ class MetaGer ...@@ -786,7 +787,7 @@ class MetaGer
# Anschließend werden diese beiden Listen verglichen (jeweils eine der Fokuslisten für jeden Fokus), um herauszufinden ob sie vielleicht identisch sind. Ist dies der Fall, so hat der Nutzer anscheinend Suchmaschinen eines kompletten Fokus eingestellt. Der Fokus wird dementsprechend angepasst. # Anschließend werden diese beiden Listen verglichen (jeweils eine der Fokuslisten für jeden Fokus), um herauszufinden ob sie vielleicht identisch sind. Ist dies der Fall, so hat der Nutzer anscheinend Suchmaschinen eines kompletten Fokus eingestellt. Der Fokus wird dementsprechend angepasst.
foreach ($foki as $fok => $engines) { foreach ($foki as $fok => $engines) {
$isFokus = true; $isFokus = true;
$fokiEngNames = []; $fokiEngNames = [];
foreach ($engines as $eng) { foreach ($engines as $eng) {
$fokiEngNames[] = $eng; $fokiEngNames[] = $eng;
...@@ -835,7 +836,7 @@ class MetaGer ...@@ -835,7 +836,7 @@ class MetaGer
{ {
$timeStart = microtime(true); $timeStart = microtime(true);
$results = null; $results = null;
while (true) { while (true) {
$results = Redis::hgetall('search.' . $this->getHashCode()); $results = Redis::hgetall('search.' . $this->getHashCode());
...@@ -932,7 +933,7 @@ class MetaGer ...@@ -932,7 +933,7 @@ class MetaGer
} }
# Sucheingabe # Sucheingabe
$this->eingabe = trim($request->input('eingabe', '')); $this->eingabe = trim($request->input('eingabe', ''));
$this->q = mb_strtolower($this->eingabe, "UTF-8"); $this->q = mb_strtolower($this->eingabe, "UTF-8");
# IP # IP
$this->ip = $request->ip(); $this->ip = $request->ip();
# Unser erster Schritt wird sein, IP-Adresse und USER-Agent zu anonymisieren, damit # Unser erster Schritt wird sein, IP-Adresse und USER-Agent zu anonymisieren, damit
...@@ -959,7 +960,7 @@ class MetaGer ...@@ -959,7 +960,7 @@ class MetaGer
$this->lang = "all"; $this->lang = "all";
} }
$this->agent = new Agent(); $this->agent = new Agent();
$this->mobile = $this->agent->isMobile(); $this->mobile = $this->agent->isMobile();
# Sprüche # Sprüche
$this->sprueche = $request->input('sprueche', 'on'); $this->sprueche = $request->input('sprueche', 'on');
...@@ -986,14 +987,14 @@ class MetaGer ...@@ -986,14 +987,14 @@ class MetaGer
$this->resultCount = $request->input('resultCount', '20'); $this->resultCount = $request->input('resultCount', '20');
# Manchmal müssen wir Parameter anpassen um den Sucheinstellungen gerecht zu werden: # Manchmal müssen wir Parameter anpassen um den Sucheinstellungen gerecht zu werden:
if ($request->filled('dart')) { if ($request->filled('dart')) {
$this->time = 10000; $this->time = 10000;
$this->warnings[] = trans('metaGer.formdata.dartEurope'); $this->warnings[] = trans('metaGer.formdata.dartEurope');
} }
if ($this->time <= 500 || $this->time > 20000) { if ($this->time <= 500 || $this->time > 20000) {
$this->time = 1000; $this->time = 1000;
} }
if ($request->filled('minism') && ($request->filled('fportal') || $request->filled('harvest'))) { if ($request->filled('minism') && ($request->filled('fportal') || $request->filled('harvest'))) {
$input = $request->all(); $input = $request->all();
$newInput = []; $newInput = [];
foreach ($input as $key => $value) { foreach ($input as $key => $value) {
if ($key !== "fportal" && $key !== "harvest") { if ($key !== "fportal" && $key !== "harvest") {
...@@ -1009,7 +1010,7 @@ class MetaGer ...@@ -1009,7 +1010,7 @@ class MetaGer
$this->resultCount = 1000; $this->resultCount = 1000;
} }
if ($request->filled('onenewspageAll') || $request->filled('onenewspageGermanyAll')) { if ($request->filled('onenewspageAll') || $request->filled('onenewspageGermanyAll')) {
$this->time = 5000; $this->time = 5000;
$this->cache = "cache"; $this->cache = "cache";
} }
if ($request->filled('password')) { if ($request->filled('password')) {
...@@ -1022,21 +1023,21 @@ class MetaGer ...@@ -1022,21 +1023,21 @@ class MetaGer
} }
$this->apiKey = $request->input('key', ''); $this->apiKey = $request->input('key', '');
$this->validated = false; $this->validated = false;
if (isset($this->password)) { if (isset($this->password)) {
# Wir bieten einen bezahlten API-Zugriff an, bei dem dementsprechend die Werbung ausgeblendet wurde: # Wir bieten einen bezahlten API-Zugriff an, bei dem dementsprechend die Werbung ausgeblendet wurde:
# Aktuell ist es nur die Uni-Mainz. Deshalb überprüfen wir auch nur diese. # Aktuell ist es nur die Uni-Mainz. Deshalb überprüfen wir auch nur diese.
$password = getenv('mainz'); $password = getenv('mainz');
$passwordBerlin = getenv('berlin'); $passwordBerlin = getenv('berlin');
$eingabe = $this->eingabe; $eingabe = $this->eingabe;
$password = md5($eingabe . $password); $password = md5($eingabe . $password);
$passwordBerlin = md5($eingabe . $passwordBerlin); $passwordBerlin = md5($eingabe . $passwordBerlin);
if ($this->password === $password || $this->password === $passwordBerlin) { if ($this->password === $password || $this->password === $passwordBerlin) {
$this->validated = true; $this->validated = true;
} }
} }
$this->out = $request->input('out', "html"); $this->out = $request->input('out', "html");
# Standard output format html # Standard output format html
if ($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style" && $this->out !== "result-count" && $this->out !== "rss20" && $this->out !== "atom10" && $this->out !== "rich") { if ($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style" && $this->out !== "result-count" && $this->out !== "rss20" && $this->out !== "atom10" && $this->out !== "rich") {
...@@ -1049,7 +1050,7 @@ class MetaGer ...@@ -1049,7 +1050,7 @@ class MetaGer
# ob MetaGer funktioniert (bzw. die Fetcher laufen) # ob MetaGer funktioniert (bzw. die Fetcher laufen)
# Auch ein Log sollte nicht geschrieben werden, da es am Ende ziemlich viele Logs werden könnten.