diff --git a/.gitlab/deployment_scripts/update_secret.sh b/.gitlab/deployment_scripts/update_secret.sh index ce233fd7b96ff6d59917ab72e8391d0bd8360b9a..32a0fcd0813b6f52f1788aef902984723101c21f 100755 --- a/.gitlab/deployment_scripts/update_secret.sh +++ b/.gitlab/deployment_scripts/update_secret.sh @@ -8,7 +8,7 @@ HELM_RELEASE_NAME=$(echo $HELM_RELEASE_NAME | sed 's/-$//') # Create/Update the secret kubectl -n $KUBE_NAMESPACE create secret generic ${HELM_RELEASE_NAME} \ --from-file=${ENV_PRODUCTION} \ - --from-file=SUMAS_JSON=${NEW_SUMAS} \ + --from-file=SUMAS_JSON=${SUMAS} \ --from-file=${ADBLACKLIST_DOMAINS} \ --from-file=${ADBLACKLIST_URL} \ --from-file=${BLACKLIST_DESCRIPTION_URL} \ diff --git a/metager/app/Http/Controllers/SearchEngineList.php b/metager/app/Http/Controllers/SearchEngineList.php index 65ca36ab8605ffbb1f017ea94bc4eddf98a55d75..30977d172e4eac555a97453c426d72182e66e7d0 100644 --- a/metager/app/Http/Controllers/SearchEngineList.php +++ b/metager/app/Http/Controllers/SearchEngineList.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers; use App\Localization; +use App\Models\Configuration\Searchengines; +use App\Models\DisabledReason; use LaravelLocalization; class SearchEngineList extends Controller @@ -23,30 +25,24 @@ class SearchEngineList extends Controller $locale = LaravelLocalization::getCurrentLocaleRegional(); $lang = Localization::getLanguage(); $sumas = []; + + $search_engines = app(Searchengines::class); + foreach ($suma_file->foki as $fokus_name => $fokus) { foreach ($fokus->sumas as $suma_name) { - if ( - ## Lang support is not defined - (\property_exists($suma_file->sumas->{$suma_name}, "lang") && \property_exists($suma_file->sumas->{$suma_name}->lang, "languages") && \property_exists($suma_file->sumas->{$suma_name}->lang, "regions")) && - ## Current Locale/Lang is not supported by this engine - (\property_exists($suma_file->sumas->{$suma_name}->lang->languages, $lang) || \property_exists($suma_file->sumas->{$suma_name}->lang->regions, $locale)) - ) { - $sumas[$fokus_name][] = $suma_name; - } - } - } - $suma_infos = []; - foreach ($sumas as $fokus_name => $suma_list) { - foreach ($suma_list as $index => $suma_name) { - if (!$suma_file->sumas->{$suma_name}->disabled) { - $infos = $suma_file->sumas->{$suma_name}->infos; - $suma_infos[$fokus_name][$suma_name] = clone $infos; - } + if (!array_key_exists($suma_name, $search_engines->sumas)) + continue; + if ($search_engines->sumas[$suma_name]->configuration->disabled && in_array(DisabledReason::SUMAS_CONFIGURATION, $search_engines->sumas[$suma_name]->configuration->disabledReasons)) + continue; + if (!array_key_exists($fokus_name, $sumas)) + $sumas[$fokus_name] = []; + $sumas[$fokus_name][$suma_name] = $search_engines->sumas[$suma_name]->configuration->infos; } } + return view('search-engine') ->with('title', trans('titles.search-engine')) ->with('navbarFocus', 'info') - ->with('suma_infos', $suma_infos); + ->with('suma_infos', $sumas); } } diff --git a/metager/app/MetaGer.php b/metager/app/MetaGer.php index b178a5ff4bccefbd60ac6fa2d3a5a61b5442fc64..0b042418a487d3b6183c7422d9ae99fd640de745 100644 --- a/metager/app/MetaGer.php +++ b/metager/app/MetaGer.php @@ -97,7 +97,7 @@ class MetaGer $this->domainsBlacklisted = explode("\n", $tmp); $tmp = file_get_contents(config_path() . "/blacklistUrl.txt"); $lines = explode("\n", $tmp); - $filtered_lines = array_filter($lines, function($line) { + $filtered_lines = array_filter($lines, function ($line) { return strpos(trim($line), '#') !== 0; }); # Re-index the array (array_filter preserves keys by default) @@ -1315,7 +1315,7 @@ class MetaGer public function popAd() { - if (count($this->ads) > 0) { + if (count($this->results) > 0 && count($this->ads) > 0) { return array_shift($this->ads); } else { return null; diff --git a/metager/app/Models/Configuration/Searchengines.php b/metager/app/Models/Configuration/Searchengines.php index 1ab7f63a69da774651f461f869856e4b36344b30..add97063e20af598218868c2eaf950dc87372ca1 100644 --- a/metager/app/Models/Configuration/Searchengines.php +++ b/metager/app/Models/Configuration/Searchengines.php @@ -88,12 +88,27 @@ class Searchengines } // Enable Yahoo Ads if query is unauthorized and yahoo is disabled - if (!app(Authorization::class)->canDoAuthenticatedSearch() && $settings->fokus !== "bilder" && array_key_exists("yahoo", $this->sumas) && array_key_exists("yahoo-ads", $this->sumas)) { + // Do not enable yahoo-ads anymore. For now temporarily + // ToDo: Remove or enable again + if (1 == 0 && !app(Authorization::class)->canDoAuthenticatedSearch() && $settings->fokus !== "bilder" && array_key_exists("yahoo", $this->sumas) && array_key_exists("yahoo-ads", $this->sumas)) { if ($this->sumas["yahoo"]->configuration->disabled === true) { $this->sumas["yahoo-ads"]->configuration->disabled = false; } } + // If user manuall + + // Disable other searchengines if yahoo is enabled + if ($this->sumas["yahoo"]->configuration->disabled === false) { + foreach ($this->sumas as $suma_name => $suma) { + if ($suma_name === "yahoo") + continue; + $suma->configuration->disabled = true; + $suma->configuration->disabledReasons[] = DisabledReason::PAYMENT_REQUIRED; + $this->disabledReasons[] = DisabledReason::PAYMENT_REQUIRED; + } + } + $settings->loadQueryFilter(); $settings->loadParameterFilter($this); $authorization = app(Authorization::class); diff --git a/metager/app/Models/SearchengineConfiguration.php b/metager/app/Models/SearchengineConfiguration.php index 1d249418d1f3b72ee4132628900dd43b9c24df31..e48d6b09ad06deabc2ac96f799e915cf1ed1f568 100644 --- a/metager/app/Models/SearchengineConfiguration.php +++ b/metager/app/Models/SearchengineConfiguration.php @@ -32,13 +32,13 @@ class SearchengineConfiguration /** @var object */ public $requestHeader; /** @var float */ - public $engineBoost; + public $engineBoost = 1.0; /** @var int */ public $cacheDuration = 60; /** @var int */ public $cost = 0; /** @var bool */ - public $disabled; + public $disabled = false; /** @var DisabledReason */ public $disabledReasons = []; /** @var bool */ @@ -46,7 +46,7 @@ class SearchengineConfiguration /** @var bool */ public $ads = false; /** @var bool */ - public $filterOptIn; + public $filterOptIn = false; /** @var int */ public $monthlyRequests; /** @var SearchEngineInfos */ @@ -57,58 +57,140 @@ class SearchengineConfiguration public function __construct($engineConfigurationJson) { try { - $this->host = $engineConfigurationJson->host; - $this->path = $engineConfigurationJson->path; - $this->port = $engineConfigurationJson->port; + /** Required parameters from json file */ + $this->host = $engineConfigurationJson->host; + $this->path = $engineConfigurationJson->path; + $this->port = $engineConfigurationJson->port; $this->queryParameter = $engineConfigurationJson->{"query-parameter"}; - $this->inputEncoding = $engineConfigurationJson->{"input-encoding"}; + $this->inputEncoding = $engineConfigurationJson->{"input-encoding"}; $this->outputEncoding = $engineConfigurationJson->{"output-encoding"}; + + /** + * optional parameters fo here + * might get overriden in Searchengine implementation constructor + * */ if ( + property_exists($engineConfigurationJson, "http-auth-credentials") && is_object($engineConfigurationJson->{"http-auth-credentials"}) && property_exists($engineConfigurationJson->{"http-auth-credentials"}, "username") && property_exists($engineConfigurationJson->{"http-auth-credentials"}, "password") ) { - $this->httpAuthUsername = $engineConfigurationJson->{"http-auth-credentials"}->username; - $this->httpAuthPassword = $engineConfigurationJson->{"http-auth-credentials"}->password; + $this->setHttpAuth($engineConfigurationJson->{"http-auth-credentials"}->username, $engineConfigurationJson->{"http-auth-credentials"}->password); + } + if (property_exists($engineConfigurationJson, "get-parameter") && is_object($engineConfigurationJson->{"get-parameter"})) { + $this->addQueryParameters($engineConfigurationJson->{"get-parameter"}); + } else { + $this->addQueryParameters([]); + } + if (property_exists($engineConfigurationJson, "lang")) { + $this->setLanguages($engineConfigurationJson->lang->parameter, $engineConfigurationJson->lang->languages, $engineConfigurationJson->lang->regions); + } + if (property_exists($engineConfigurationJson, "request-header")) { + $this->addRequestHeaders($engineConfigurationJson->{"request-header"}); + } else { + $this->addRequestHeaders([]); } - $this->getParameter = $engineConfigurationJson->{"get-parameter"}; - $this->languages = new SearchEngineLanguages($engineConfigurationJson->lang); - $this->requestHeader = $engineConfigurationJson->{"request-header"}; - $this->engineBoost = $engineConfigurationJson->{"engine-boost"}; - if ($engineConfigurationJson->{"cache-duration"} > -1) { + if (property_exists($engineConfigurationJson, "engine-boost")) + $this->engineBoost = $engineConfigurationJson->{"engine-boost"}; + if (property_exists($engineConfigurationJson, "cache-duration") && $engineConfigurationJson->{"cache-duration"} > -1) { $this->cacheDuration = max($engineConfigurationJson->{"cache-duration"}, 5); } - $this->disabled = $engineConfigurationJson->disabled; + if (property_exists($engineConfigurationJson, "disabled")) { + $this->disabled = $engineConfigurationJson->disabled; + } if ($this->disabled) { $this->disabledReasons[] = DisabledReason::SUMAS_CONFIGURATION; } - $this->filterOptIn = $engineConfigurationJson->{"filter-opt-in"}; + if (property_exists($engineConfigurationJson, "filter-opt-in")) + $this->filterOptIn = $engineConfigurationJson->{"filter-opt-in"}; if (property_exists($engineConfigurationJson, "monthly-requests")) { $this->monthlyRequests = $engineConfigurationJson->{"monthly-requests"}; } if (property_exists($engineConfigurationJson, "ads")) { $this->ads = $engineConfigurationJson->ads; } - $this->infos = new SearchEngineInfos($engineConfigurationJson->infos); - $this->cost = $engineConfigurationJson->cost; + if (property_exists($engineConfigurationJson, "infos")) { + $infos = $engineConfigurationJson->infos; + $homepage = property_exists($infos, "homepage") ? $infos->homepage : ""; + $index_name = property_exists($infos, "index_name") ? $infos->index_name : ""; + $display_name = property_exists($infos, "display_name") ? $infos->display_name : ""; + $founded = property_exists($infos, "founded") ? $infos->founded : ""; + $headquarter = property_exists($infos, "headquarter") ? $infos->headquarter : ""; + $operator = property_exists($infos, "operator") ? $infos->operator : ""; + $index_size = property_exists($infos, "index_size") ? $infos->index_size : ""; + $this->infos = new SearchEngineInfos($homepage, $index_name, $display_name, $founded, $headquarter, $operator, $index_size); + } + if (property_exists($engineConfigurationJson, "cost")) + $this->cost = $engineConfigurationJson->cost; } catch (\Exception $e) { + $this->disabled = true; + $this->disabledReasons[] = DisabledReason::SUMAS_CONFIGURATION; Log::error($e->getTraceAsString()); } } public function applyLocale() { - $key = $this->languages->getParameter; + $key = $this->languages->getParameter; $value = $this->languages->getParameterForLocale(); if ($value !== null) { $this->getParameter->{$key} = $value; } else { - $this->disabled = true; + $this->disabled = true; $this->disabledReasons[] = DisabledReason::INCOMPATIBLE_LOCALE; } } + public function setHttpAuth(string $username, string $password) + { + if (empty($username) || empty($password)) + return; + $this->httpAuthUsername = $username; + $this->httpAuthPassword = $password; + } + + /** + * Configures supported languages for this searchengine + * @param string $getParameter query parameter key used by the searchengine to switch the language + * @param object|array $languages associates specific two letter language codes from MetaGer with a given query paramaeter value + * @param object|array $regions associates specific four letter language/region (i.e. de_DE) combinations with a given query parameter value + */ + public function setLanguages(string $getParameter, object|array $languages, object|array $regions) + { + if (is_array($languages)) { + // Languages supplied as array: convert to an object + $languages = json_decode(json_encode($languages, JSON_FORCE_OBJECT), false); + } + if (is_array($regions)) { + // Languages supplied as array: convert to an object + $regions = json_decode(json_encode($regions, JSON_FORCE_OBJECT), false); + } + $this->languages = new SearchEngineLanguages($getParameter, $languages, $regions); + } + + public function addRequestHeaders(object|array $requestHeader) + { + if (is_array($requestHeader)) { + $requestHeader = json_decode(json_encode($requestHeader, JSON_FORCE_OBJECT), false); + } + if ($this->requestHeader === null) { + $this->requestHeader = new \stdClass; + } + $this->requestHeader = (object) array_merge((array) $this->requestHeader, (array) $requestHeader); + } + + public function addQueryParameters(object|array $queryParameters) + { + if (is_array($queryParameters)) { + $queryParameters = json_decode(json_encode($queryParameters, JSON_FORCE_OBJECT), false); + } + if ($this->getParameter === null) { + $this->getParameter = new \stdClass; + } + $this->getParameter = (object) array_merge((array) $this->getParameter, (array) $queryParameters); + } + public function applyQuery(string $query) { $this->getParameter->{$this->queryParameter} = $query; @@ -125,16 +207,16 @@ class SearchEngineLanguages /** @var object */ private $regions; - public function __construct(object $langJson) + public function __construct(string $getParameter, object $languages, object $regions) { - $this->getParameter = $langJson->parameter; - $this->languages = $langJson->languages; - $this->regions = $langJson->regions; + $this->getParameter = $getParameter; + $this->languages = $languages; + $this->regions = $regions; } public function getParameterForLocale() { - $locale = LaravelLocalization::getCurrentLocaleRegional(); + $locale = LaravelLocalization::getCurrentLocaleRegional(); $language = Localization::getLanguage(); if (\property_exists($this->regions, $locale)) { return $this->regions->{$locale}; @@ -163,14 +245,14 @@ class SearchEngineInfos /** @var string */ public $indexSize; - public function __construct(object $langJson) + public function __construct(string $homepage = null, string $index_name = null, string $display_name = null, string $founded = null, string $headquarter = null, string $operator = null, string $index_size = null) { - $this->homepage = $langJson->homepage; - $this->indexName = $langJson->index_name; - $this->displayName = $langJson->display_name; - $this->founded = $langJson->founded; - $this->headquarter = $langJson->headquarter; - $this->operator = $langJson->operator; - $this->indexSize = $langJson->index_size; + $this->homepage = $homepage; + $this->indexName = $index_name; + $this->displayName = $display_name; + $this->founded = $founded; + $this->headquarter = $headquarter; + $this->operator = $operator; + $this->indexSize = $index_size; } } \ No newline at end of file diff --git a/metager/app/Models/parserSkripte/Brave.php b/metager/app/Models/parserSkripte/Brave.php index 42c9d2801ef943402071676211e8f098aa28cce1..e16d5c27be12baf49808223345f11f845499df7c 100644 --- a/metager/app/Models/parserSkripte/Brave.php +++ b/metager/app/Models/parserSkripte/Brave.php @@ -7,6 +7,8 @@ use App\Models\DeepResults\Button; use App\Models\Result; use App\Models\Searchengine; use App\Models\SearchengineConfiguration; +use App\Models\SearchEngineInfos; +use App\Models\SearchEngineLanguages; use LaravelLocalization; use Log; use Request; @@ -18,6 +20,35 @@ class Brave extends Searchengine public function __construct($name, SearchengineConfiguration $configuration) { parent::__construct($name, $configuration); + + $this->configuration->engineBoost = 1.2; + $this->configuration->cost = 1; + + $this->configuration->addQueryParameters([ + "count" => 20, + "offset" => 0 + ]); + + $this->configuration->setLanguages("country", [], [ + "de_DE" => "DE", + "de_AT" => "AT", + "en_US" => "US", + "en_GB" => "GB", + "es_ES" => "ES", + "es_MX" => "MX", + "da_DK" => "DK", + "at_AT" => "AT", + "de_CH" => "CH", + "fi_FI" => "FI", + "it_IT" => "IT", + "nl_NL" => "NL", + "sv_SE" => "SE", + "fr_FR" => "FR", + "fr_CA" => "CA", + "pl_PL" => "PL" + ]); + + $this->configuration->infos = new SearchEngineInfos("https://search.brave.com/", "Brave Search", "Brave", "Juni 2021", "San Francisco", "Brave San Francisco", "einige Milliarden"); } public function applySettings() diff --git a/metager/app/Models/parserSkripte/BraveImages.php b/metager/app/Models/parserSkripte/BraveImages.php index 8cff4a34dc2e5cd7c6f311e8eb947066f8d09068..10ac720d978b49b2e169d41f1af6cbca3d7d3a0f 100644 --- a/metager/app/Models/parserSkripte/BraveImages.php +++ b/metager/app/Models/parserSkripte/BraveImages.php @@ -8,6 +8,8 @@ use App\Models\DeepResults\Imagesearchdata; use App\Models\Result; use App\Models\Searchengine; use App\Models\SearchengineConfiguration; +use App\Models\SearchEngineInfos; +use App\Models\SearchEngineLanguages; use LaravelLocalization; use Log; use Request; @@ -20,6 +22,35 @@ class BraveImages extends Searchengine { parent::__construct($name, $configuration); $this->configuration->disabledByDefault = true; + + $this->configuration->engineBoost = 1.2; + $this->configuration->cost = 1; + + $this->configuration->addQueryParameters([ + "count" => 100, + "offset" => 0 + ]); + + $this->configuration->setLanguages("country", [], [ + "de_DE" => "DE", + "de_AT" => "AT", + "en_US" => "US", + "en_GB" => "GB", + "es_ES" => "ES", + "es_MX" => "MX", + "da_DK" => "DK", + "at_AT" => "AT", + "de_CH" => "CH", + "fi_FI" => "FI", + "it_IT" => "IT", + "nl_NL" => "NL", + "sv_SE" => "SE", + "fr_FR" => "FR", + "fr_CA" => "CA", + "pl_PL" => "PL" + ]); + + $this->configuration->infos = new SearchEngineInfos("https://search.brave.com/", "Brave Search", "Brave", "Juni 2021", "San Francisco", "Brave San Francisco", "einige Milliarden"); } public function applySettings() @@ -27,18 +58,18 @@ class BraveImages extends Searchengine parent::applySettings(); // Setup UI Lang to match users language - $locale = LaravelLocalization::getCurrentLocale(); + $locale = LaravelLocalization::getCurrentLocale(); $this->configuration->getParameter->ui_lang = $locale; // Brave has divided country search setting and language search setting // MetaGer will configure something like de_DE // We need to seperate both parameters and put them into their respective get parameters if (property_exists($this->configuration->getParameter, "country") && preg_match("/^[^_]+_[^_]+$/", $this->configuration->getParameter->country)) { - $values = explode("_", $this->configuration->getParameter->country); + $values = explode("_", $this->configuration->getParameter->country); $this->configuration->getParameter->search_lang = $values[0]; - $this->configuration->getParameter->country = $values[1]; + $this->configuration->getParameter->country = $values[1]; } else { $this->configuration->getParameter->search_lang = Localization::getLanguage(); - $this->configuration->getParameter->country = Localization::getRegion(); + $this->configuration->getParameter->country = Localization::getRegion(); } } @@ -50,10 +81,10 @@ class BraveImages extends Searchengine // Check if the query got altered if (!empty($results->{"query"}) && !empty($results->{"query"}->{"altered"}) && $results->query->altered !== $results->query->original) { $this->alteredQuery = $results->{"query"}->{"altered"}; - $override = ""; - $original = trim($results->query->original); - $wordstart = true; - $inphrase = false; + $override = ""; + $original = trim($results->query->original); + $wordstart = true; + $inphrase = false; for ($i = 0; $i < strlen($original); $i++) { $char = $original[$i]; if ($wordstart && !$inphrase) { @@ -75,10 +106,10 @@ class BraveImages extends Searchengine } foreach ($results->results as $result) { - $title = html_entity_decode($result->title); - $link = $result->url; + $title = html_entity_decode($result->title); + $link = $result->url; $anzeigeLink = $result->meta_url->netloc . " " . $result->meta_url->path; - $descr = null; + $descr = null; $this->counter++; $newResult = new Result( $this->configuration->engineBoost, @@ -115,10 +146,10 @@ class BraveImages extends Searchengine } /** @var SearchEngineConfiguration */ - $newConfiguration = unserialize(serialize($this->configuration)); + $newConfiguration = unserialize(serialize($this->configuration)); $newConfiguration->getParameter->offset += 1; - $next = new BraveImages($this->name, $newConfiguration); + $next = new BraveImages($this->name, $newConfiguration); $this->next = $next; } catch (\Exception $e) { Log::error("A problem occurred parsing results from $this->name:"); diff --git a/metager/app/Models/parserSkripte/BraveNews.php b/metager/app/Models/parserSkripte/BraveNews.php index c21856c2855091fe7898d322f45f59218d2fb71a..06f03c65762a219730f4aa256cdc7d2e104c1506 100644 --- a/metager/app/Models/parserSkripte/BraveNews.php +++ b/metager/app/Models/parserSkripte/BraveNews.php @@ -6,6 +6,8 @@ use App\Localization; use App\Models\Result; use App\Models\Searchengine; use App\Models\SearchengineConfiguration; +use App\Models\SearchEngineInfos; +use App\Models\SearchEngineLanguages; use LaravelLocalization; use Log; @@ -16,6 +18,35 @@ class BraveNews extends Searchengine public function __construct($name, SearchengineConfiguration $configuration) { parent::__construct($name, $configuration); + + $this->configuration->engineBoost = 1.2; + $this->configuration->cost = 1; + + $this->configuration->addQueryParameters([ + "count" => 100, + "offset" => 0 + ]); + + $this->configuration->setLanguages("country", [], [ + "de_DE" => "DE", + "de_AT" => "AT", + "en_US" => "US", + "en_GB" => "GB", + "es_ES" => "ES", + "es_MX" => "MX", + "da_DK" => "DK", + "at_AT" => "AT", + "de_CH" => "CH", + "fi_FI" => "FI", + "it_IT" => "IT", + "nl_NL" => "NL", + "sv_SE" => "SE", + "fr_FR" => "FR", + "fr_CA" => "CA", + "pl_PL" => "PL" + ]); + + $this->configuration->infos = new SearchEngineInfos("https://search.brave.com/", "Brave Search", "Brave", "Juni 2021", "San Francisco", "Brave San Francisco", "einige Milliarden"); } public function applySettings() @@ -23,18 +54,18 @@ class BraveNews extends Searchengine parent::applySettings(); // Setup UI Lang to match users language - $locale = LaravelLocalization::getCurrentLocale(); + $locale = LaravelLocalization::getCurrentLocale(); $this->configuration->getParameter->ui_lang = $locale; // Brave has divided country search setting and language search setting // MetaGer will configure something like de_DE // We need to seperate both parameters and put them into their respective get parameters if (property_exists($this->configuration->getParameter, "country") && preg_match("/^[^_]+_[^_]+$/", $this->configuration->getParameter->country)) { - $values = explode("_", $this->configuration->getParameter->country); + $values = explode("_", $this->configuration->getParameter->country); $this->configuration->getParameter->search_lang = $values[0]; - $this->configuration->getParameter->country = $values[1]; + $this->configuration->getParameter->country = $values[1]; } else { $this->configuration->getParameter->search_lang = Localization::getLanguage(); - $this->configuration->getParameter->country = Localization::getRegion(); + $this->configuration->getParameter->country = Localization::getRegion(); } } @@ -46,10 +77,10 @@ class BraveNews extends Searchengine // Check if the query got altered if (!empty($results->{"query"}) && !empty($results->{"query"}->{"altered"}) && $results->query->altered !== $results->query->original) { $this->alteredQuery = $results->{"query"}->{"altered"}; - $override = ""; - $original = trim($results->query->original); - $wordstart = true; - $inphrase = false; + $override = ""; + $original = trim($results->query->original); + $wordstart = true; + $inphrase = false; for ($i = 0; $i < strlen($original); $i++) { $char = $original[$i]; if ($wordstart && !$inphrase) { @@ -71,10 +102,10 @@ class BraveNews extends Searchengine } foreach ($results->results as $result) { - $title = html_entity_decode($result->title); - $link = $result->url; + $title = html_entity_decode($result->title); + $link = $result->url; $anzeigeLink = $result->meta_url->netloc . " " . $result->meta_url->path; - $descr = html_entity_decode($result->description); + $descr = html_entity_decode($result->description); $this->counter++; $additionalInformation = []; if (property_exists($result, "age")) { @@ -119,10 +150,10 @@ class BraveNews extends Searchengine } /** @var SearchEngineConfiguration */ - $newConfiguration = unserialize(serialize($this->configuration)); + $newConfiguration = unserialize(serialize($this->configuration)); $newConfiguration->getParameter->offset += 1; - $next = new BraveNews($this->name, $newConfiguration); + $next = new BraveNews($this->name, $newConfiguration); $this->next = $next; } catch (\Exception $e) { Log::error("A problem occurred parsing results from $this->name:"); diff --git a/metager/app/Models/parserSkripte/Onenewspagegermany.php b/metager/app/Models/parserSkripte/Onenewspagegermany.php index 3fe4af34f2e028d5598aeb187cfdeefb2f8c80df..79ddcacf6c79b82c7b2e8a0829830467e38ebed9 100644 --- a/metager/app/Models/parserSkripte/Onenewspagegermany.php +++ b/metager/app/Models/parserSkripte/Onenewspagegermany.php @@ -19,16 +19,8 @@ class Onenewspagegermany extends Searchengine { parent::__construct($name, $configuration); - $this->configuration->cost = 0; - $this->configuration->infos = new SearchEngineInfos((object) [ - "homepage" => "http://www.newsdeutschland.com/", - "index_name" => null, - "display_name" => "OneNewspage", - "founded" => "2008", - "headquarter" => "Wales, England", - "operator" => "One News Page Ltd.", - "index_size" => null, - ]); + $this->configuration->cost = 0; + $this->configuration->infos = new SearchEngineInfos("http://www.newsdeutschland.com/", null, "OneNewspage", "2008", "Wales, England", "One News Page Ltd.", null, ); } public function loadResults($result) @@ -42,13 +34,13 @@ class Onenewspagegermany extends Searchengine if (sizeof($result) < 3) { continue; } - $title = $result[0]; - $link = $result[2]; - $anzeigeLink = $link; - $descr = $result[1]; + $title = $result[0]; + $link = $result[2]; + $anzeigeLink = $link; + $descr = $result[1]; $additionalInformation = sizeof($result) > 3 ? ['date' => Carbon::createFromTimestamp(intval($result[3]))] : []; - $faviconUrl = parse_url($link, PHP_URL_SCHEME) . "://" . parse_url($link, PHP_URL_HOST) . "/favicon.ico"; + $faviconUrl = parse_url($link, PHP_URL_SCHEME) . "://" . parse_url($link, PHP_URL_HOST) . "/favicon.ico"; $additionalInformation["favicon_url"] = $faviconUrl; $counter++; @@ -93,7 +85,7 @@ class Onenewspagegermany extends Searchengine } else { $newConfiguration->getParameter->o = count($this->results); } - $next = new Onenewspagegermany($this->name, $newConfiguration); + $next = new Onenewspagegermany($this->name, $newConfiguration); $this->next = $next; } } \ No newline at end of file diff --git a/metager/app/Models/parserSkripte/Overture.php b/metager/app/Models/parserSkripte/Overture.php index a07f1f67c79a4b2b6b90d4d370999526895f8fa9..bb4971a1d432df9003c045660750d3da58d9c109 100644 --- a/metager/app/Models/parserSkripte/Overture.php +++ b/metager/app/Models/parserSkripte/Overture.php @@ -5,6 +5,8 @@ namespace app\Models\parserSkripte; use App\MetaGer; use App\Models\Searchengine; use App\Models\SearchengineConfiguration; +use App\Models\SearchEngineInfos; +use App\Models\SearchEngineLanguages; use App\PrometheusExporter; use LaravelLocalization; use Log; @@ -34,6 +36,53 @@ class Overture extends Searchengine if (app()->environment("local")) { $this->test_mode = "true"; } + + $this->configuration->cacheDuration = 0; // No caching allowed for Yahoo + $this->configuration->ads = true; + $this->configuration->engineBoost = 1.2; + + // Apply default get parameters + $this->configuration->addQueryParameters([ + "Partner" => "tripledoubleu_xml_de_searchbox_metager", + "on" => "6", + "in" => "20", + "adEnableActionExt" => "1", + "enableFavicon" => "1", + "siteLink" => "1", + "adultFilter" => "any", + "keywordCharEnc" => "utf8" + ]); + + // Apply languages + $this->configuration->setLanguages("mkt", [], [ + "de_DE" => "de", + "de_AT" => "at", + "de_CH" => "ch", + "da_DK" => "dk", + "en_US" => "us", + "en_GB" => "uk", + "en_IE" => "ie", + "en_MY" => "my", + "es_ES" => "es", + "es_MX" => "mx", + "fi_FI" => "fi", + "sv_SE" => "se", + "it_IT" => "it", + "nl_NL" => "nl", + "pl_PL" => "pl", + "fr_FR" => "fr", + "fr_CA" => "ca" + ]); + + $this->configuration->infos = new SearchEngineInfos( + homepage: "https://de.yahoo.com/", + index_name: "Microsoft Bing", + display_name: "Yahoo", + founded: "2. März 1995", + headquarter: "New York City, USA", + operator: "Altaba Inc. (ehemals Yahoo Inc.)", + index_size: "vermutlich 8-14 Milliarden" + ); } public function applySettings() @@ -59,7 +108,7 @@ class Overture extends Searchengine $resultCount = 0; } $this->totalResults = $resultCount; - $results = $content->xpath('//Results/ResultSet[@id="inktomi"]/Listing'); + $results = $content->xpath('//Results/ResultSet[@id="inktomi"]/Listing'); if (!is_array($results)) { $results = []; } @@ -70,10 +119,10 @@ class Overture extends Searchengine } foreach ($results as $result) { - $title = html_entity_decode($result["title"]); - $link = $result->{"ClickUrl"}->__toString(); + $title = html_entity_decode($result["title"]); + $link = $result->{"ClickUrl"}->__toString(); $anzeigeLink = $result["siteHost"]; - $descr = html_entity_decode($result["description"]); + $descr = html_entity_decode($result["description"]); $this->counter++; $this->results[] = new \App\Models\Result( $this->configuration->engineBoost, @@ -125,10 +174,10 @@ class Overture extends Searchengine // Nun noch die Werbeergebnisse: /** @var SimpleXMLElement $ad */ foreach ($ads as $ad) { - $title = html_entity_decode($ad["title"]); - $link = $ad->{"ClickUrl"}->__toString(); + $title = html_entity_decode($ad["title"]); + $link = $ad->{"ClickUrl"}->__toString(); $anzeigeLink = $ad["siteHost"]; - $descr = html_entity_decode($ad["description"]); + $descr = html_entity_decode($ad["description"]); $this->counter++; // Advertisement Data of result @@ -137,10 +186,10 @@ class Overture extends Searchengine $yiid = $ad["ImpressionId"]->__toString(); } $appns = null; - $k = null; + $k = null; if (isset($ad["appNs"]) && isset($ad["k"])) { $appns = $ad["appNs"]->__toString(); - $k = $ad["k"]->__toString(); + $k = $ad["k"]->__toString(); } $this->ads[] = new \App\Models\Result( @@ -154,9 +203,9 @@ class Overture extends Searchengine $this->counter, [ "ad_data" => [ - "yiid" => $yiid, + "yiid" => $yiid, "appns" => $appns, - "k" => $k, + "k" => $k, ], ] ); @@ -164,7 +213,7 @@ class Overture extends Searchengine if (sizeof($this->results) === 0 && sizeof($this->ads) === 0 && !$this->failed) { $this->log_failed_yahoo_search(); $this->configuration->getParameter->Keywords .= " -qwertzy"; - $this->cached = false; + $this->cached = false; Redis::del($this->getHash()); $this->startSearch(); } @@ -197,9 +246,9 @@ class Overture extends Searchengine // 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'); + $results = $content->xpath('//Results/ResultSet[@id="inktomi"]/Listing'); if (isset($resultCount[0]) && sizeof($results) > 0) { - $resultCount = intval($resultCount[0]->__toString()); + $resultCount = intval($resultCount[0]->__toString()); $lastResultOnPage = intval($results[sizeof($results) - 1]["rank"]); if ($resultCount <= $lastResultOnPage) { return; @@ -227,7 +276,7 @@ class Overture extends Searchengine $newConfiguration->getParameter->$key = $value; } # Erstellen des neuen Suchmaschinenobjekts und anpassen des GetStrings: - $next = new Overture($this->name, $newConfiguration); + $next = new Overture($this->name, $newConfiguration); $this->next = $next; } @@ -247,7 +296,7 @@ class Overture extends Searchengine } $this->configuration->getParameter->affilData = $affil_data; - $this->configuration->getParameter->serveUrl = $url; + $this->configuration->getParameter->serveUrl = $url; } private function log_failed_yahoo_search() @@ -256,12 +305,12 @@ class Overture extends Searchengine $log_file = storage_path("logs/metager/yahoo_fail.csv"); $data = [ - "time" => now()->format("Y-m-d H:i:s"), + "time" => now()->format("Y-m-d H:i:s"), "locale" => LaravelLocalization::getCurrentLocale(), - "ip" => request()->ip(), - "query" => $this->configuration->getParameter->Keywords, + "ip" => request()->ip(), + "query" => $this->configuration->getParameter->Keywords, ]; - $fh = fopen($log_file, "a"); + $fh = fopen($log_file, "a"); try { fputcsv($fh, $data); } finally { diff --git a/metager/app/Models/parserSkripte/OvertureAds.php b/metager/app/Models/parserSkripte/OvertureAds.php index 20a0867e31e571b5610e187b62b68f547fe94d30..cc01bed37fe8343ec9e75f0ebc45ba1d6995ebf6 100644 --- a/metager/app/Models/parserSkripte/OvertureAds.php +++ b/metager/app/Models/parserSkripte/OvertureAds.php @@ -5,6 +5,8 @@ namespace App\Models\parserSkripte; use App\MetaGer; use App\Models\Searchengine; use App\Models\SearchengineConfiguration; +use App\Models\SearchEngineInfos; +use App\Models\SearchEngineLanguages; use Log; class OvertureAds extends Searchengine @@ -13,7 +15,50 @@ class OvertureAds extends Searchengine public function __construct($name, SearchengineConfiguration $configuration) { parent::__construct($name, $configuration); - # We need some Affil-Data for the advertisements + + $this->configuration->cacheDuration = 0; // No caching allowed for Yahoo + $this->configuration->ads = true; + $this->configuration->engineBoost = 1.2; + + // Apply default get parameters + $this->configuration->addQueryParameters([ + "Partner" => "tripledoubleu_xml_de_searchbox_metager", + "on" => "6", + "in" => "20", + "adEnableActionExt" => "1", + "enableFavicon" => "1", + "siteLink" => "1", + "adultFilter" => "any", + "keywordCharEnc" => "utf8" + ]); + + // Apply languages + $this->configuration->setLanguages("mkt", [], [ + "de_DE" => "de", + "de_AT" => "at", + "de_CH" => "ch", + "da_DK" => "dk", + "en_US" => "us", + "en_GB" => "uk", + "en_IE" => "ie", + "en_MY" => "my", + "es_ES" => "es", + "es_MX" => "mx", + "fi_FI" => "fi", + "sv_SE" => "se", + "it_IT" => "it", + "nl_NL" => "nl", + "pl_PL" => "pl", + "fr_FR" => "fr", + "fr_CA" => "ca" + ]); + + $this->configuration->infos = new SearchEngineInfos("https://de.yahoo.com/", "Microsoft Bing", "Yahoo", "2. März 1995", "New York City, USA", "Altaba Inc. (ehemals Yahoo Inc.)", "vermutlich 8-14 Milliarden"); + } + + public function applySettings() + { + parent::applySettings(); $this->setOvertureAffilData(app(MetaGer::class)->getUrl()); } diff --git a/metager/app/Models/parserSkripte/Scopia.php b/metager/app/Models/parserSkripte/Scopia.php index a9a0228084c4fc065afd8371c73819bf8850ed4a..b868cba238cd60f1982af793f692a9dc72fdb41f 100644 --- a/metager/app/Models/parserSkripte/Scopia.php +++ b/metager/app/Models/parserSkripte/Scopia.php @@ -4,6 +4,8 @@ namespace app\Models\parserSkripte; use App\Models\Searchengine; use App\Models\SearchengineConfiguration; +use App\Models\SearchEngineInfos; +use App\Models\SearchEngineLanguages; use Carbon; use Log; @@ -19,6 +21,22 @@ class Scopia extends Searchengine $configuration->monthlyRequests += 1000000; } parent::__construct($name, $configuration); + + $this->configuration->engineBoost = 0.9; + + $this->configuration->addQueryParameters([ + "s" => "0", + "l" => "de", + "c" => "metager" + ]); + + $this->configuration->setLanguages("l", [ + "de" => "de", + "en" => "en", + "es" => "es" + ], []); + + $this->configuration->infos = new SearchEngineInfos("https://metager.org/search-engine", null, "Scopia", "Circa 2016", "Newark, New Jersey, USA", "Scopia Technologies ASPEN LLC", null); } public function loadResults($result) @@ -38,10 +56,10 @@ class Scopia extends Searchengine $results = $content->xpath('//results/result'); foreach ($results as $result) { - $title = $result->title->__toString(); - $link = $result->url->__toString(); + $title = $result->title->__toString(); + $link = $result->url->__toString(); $anzeigeLink = $link; - $descr = $result->description->__toString(); + $descr = $result->description->__toString(); $this->counter++; if (!$this->containsPornContent($title . $descr) && !$this->filterScopia($link)) { //see note at filtering method @@ -80,7 +98,7 @@ class Scopia extends Searchengine "rt.com", "sputniknews.com", ]; - $target_domain = parse_url($link, PHP_URL_HOST); + $target_domain = parse_url($link, PHP_URL_HOST); if ($target_domain !== false) { foreach ($filtered_domains as $filtered_domain) { if (preg_match("/(^|\b|\.){1}" . preg_quote($filtered_domain, "/") . "$/", $target_domain)) { @@ -97,52 +115,52 @@ class Scopia extends Searchengine // We noticed scopia often serving pornographic results for non-pornographic queries. After much deliberation we decided to filter pornographic results from scopia. Those will have to be supplied by other search engines. $words = [ - "fisting" => 60, - "live cam" => 60, - "telefonsex" => 60, - "fick" => 60, - "anal" => 60, - "dildo" => 60, - "masturbat" => 60, - "gangbang" => 60, - "fotze" => 60, - "porn" => 50, - "anus" => 50, + "fisting" => 60, + "live cam" => 60, + "telefonsex" => 60, + "fick" => 60, + "anal" => 60, + "dildo" => 60, + "masturbat" => 60, + "gangbang" => 60, + "fotze" => 60, + "porn" => 50, + "anus" => 50, "penetration" => 50, - "cuckold" => 50, - "orgasmus" => 50, - "milf" => 50, - "dilf" => 50, - "voyeur" => 40, - "fuck" => 40, - "nude" => 40, - "muschi" => 40, - "sex" => 40, - "nackt" => 40, - "amateur" => 30, - "webcam" => 30, - "schlampe" => 30, - "eroti" => 30, - "dick" => 30, - "teen" => 30, - "hardcore" => 30, - "fetisch" => 30, - "pussy" => 30, - "pussies" => 30, - "cheat" => 20, - "gratis" => 20, - "geil" => 20, - "video" => 10, - "girl" => 10, - "boy" => 10, - "weib" => 10, - "titt" => 10, - "bikini" => 10, - "hot " => 10, - "pics" => 10, - "free" => 10, + "cuckold" => 50, + "orgasmus" => 50, + "milf" => 50, + "dilf" => 50, + "voyeur" => 40, + "fuck" => 40, + "nude" => 40, + "muschi" => 40, + "sex" => 40, + "nackt" => 40, + "amateur" => 30, + "webcam" => 30, + "schlampe" => 30, + "eroti" => 30, + "dick" => 30, + "teen" => 30, + "hardcore" => 30, + "fetisch" => 30, + "pussy" => 30, + "pussies" => 30, + "cheat" => 20, + "gratis" => 20, + "geil" => 20, + "video" => 10, + "girl" => 10, + "boy" => 10, + "weib" => 10, + "titt" => 10, + "bikini" => 10, + "hot " => 10, + "pics" => 10, + "free" => 10, ]; - $acc = 0; + $acc = 0; foreach ($words as $word => $score) { if (stristr($text, $word)) { $acc += $score; @@ -171,10 +189,10 @@ class Scopia extends Searchengine if ($more) { $results = $content->xpath('//results/result'); - $number = $results[sizeof($results) - 1]->number->__toString(); + $number = $results[sizeof($results) - 1]->number->__toString(); // Erstellen des neuen Suchmaschinenobjekts und anpassen des GetStrings: /** @var SearchEngineConfiguration */ - $newConfiguration = unserialize(serialize($this->configuration)); + $newConfiguration = unserialize(serialize($this->configuration)); $newConfiguration->getParameter->s = $number; $this->next = new Scopia($this->name, $newConfiguration); diff --git a/metager/lang/de/settings.php b/metager/lang/de/settings.php index a43db1629b83b2ba8652c74ef4c71c81e72a54bc..46d875fb93afbe521f94fc42fd1a1aae5d399327 100644 --- a/metager/lang/de/settings.php +++ b/metager/lang/de/settings.php @@ -52,6 +52,7 @@ return [ 'addon' => 'Durch die Installation unserer <a href=":link" target="_blank" rel="noopener">Browsererweiterung</a> können Sie verhindern, dass die MetaGer-Einstellungen versehentlich zurückgesetzt werden, wenn Sie Ihre Browserdaten löschen. ', 'no-settings' => '- Bislang noch keine Einstellungen gesetzt -', 'loadSettings' => 'Hier finden Sie einen Link, den Sie als Startseite bzw. Lesezeichen einrichten können um Ihre aktuell gesetzen Einstellungen wiederherzustellen.', + 'yahoo' => '<b>Hinweis</b>: Leider dürfen wir Suchergebnisse von Yahoo nicht mehr zusammen mit denen anderer Suchmaschinen einblenden. Deshalb sind alle anderen Suchmaschinen jetzt deaktiviert solange Yahoo eingeschaltet ist.' ], 'cost' => 'Wir berechnen mit den aktuellen Einstellungen <strong>:cost Token</strong> pro Suchanfrage.', 'cost-free' => 'Ihre Suchanfragen sind mit den aktuellen Einstellungen <strong>kostenlos</strong>.', diff --git a/metager/lang/en/settings.php b/metager/lang/en/settings.php index 84f22e1d5317acf4f4912d2067a39ef67564d8b9..5f8aaea5050d84550080f74f211d0ee47027529d 100644 --- a/metager/lang/en/settings.php +++ b/metager/lang/en/settings.php @@ -18,6 +18,7 @@ return [ 'hint' => 'These settings affect all foci and sub-pages!', 'addon' => 'By installing our <a href=":link" target="_blank" rel="noopener">browser extension</a>, you can prevent the MetaGer settings from being accidentally reset when you delete your browser data. ', 'no-settings' => '- No settings have been set yet -', + 'yahoo' => '<b>Note</b>: Unfortunately, we are no longer allowed to display Yahoo search results together with those of other search engines. Therefore, all other search engines are now disabled as long as Yahoo is enabled.' ], 'disabledByFilter' => 'Disabled by Search Filter:', 'address' => 'Address', diff --git a/metager/resources/views/layouts/ad.blade.php b/metager/resources/views/layouts/ad.blade.php index 871d10490a1912cd1d8c0d19ec8b60acf9c20c57..d2237488ee93e2c3a5112cf8749f9dfe0b1b4a38 100644 --- a/metager/resources/views/layouts/ad.blade.php +++ b/metager/resources/views/layouts/ad.blade.php @@ -1,13 +1,8 @@ -@if(isset($ad) && !app(\App\Models\Authorization\Authorization::class)->canDoAuthenticatedSearch()) - <div class="result" - role="listitem" - @if(array_key_exists('ad_data', $ad->additionalInformation)) - data-yiid="{{ $ad->additionalInformation['ad_data']['yiid'] }}" - @if($ad->additionalInformation['ad_data']['appns'] !== null && $ad->additionalInformation['ad_data']['k'] !== null) - data-appns="{{ $ad->additionalInformation['ad_data']['appns'] }}" - data-k="{{ $ad->additionalInformation['ad_data']['k'] }}" - @endif - @endif> +@if(!empty($ad) && !app(\App\Models\Authorization\Authorization::class)->canDoAuthenticatedSearch()) + <div class="result" role="listitem" @if(array_key_exists('ad_data', $ad->additionalInformation)) + data-yiid="{{ $ad->additionalInformation['ad_data']['yiid'] }}" @if($ad->additionalInformation['ad_data']['appns'] !== null && $ad->additionalInformation['ad_data']['k'] !== null) + data-appns="{{ $ad->additionalInformation['ad_data']['appns'] }}" + data-k="{{ $ad->additionalInformation['ad_data']['k'] }}" @endif @endif> <div class="result-header"> <div class="result-headline"> <h2 class="result-title"> @@ -15,15 +10,16 @@ {{ $ad->titel }} </a> </h2> - <a class="result-hoster" href="{{ $ad->gefVonLink[0] }}" target="{{ $metager->getNewtab() }}" rel="noopener" referrerpolicy="no-referrer-when-downgrade">{{ trans('result.gefVon') . " " . $ad->gefVon[0] }} </a> + <a class="result-hoster" href="{{ $ad->gefVonLink[0] }}" target="{{ $metager->getNewtab() }}" rel="noopener" + referrerpolicy="no-referrer-when-downgrade">{{ trans('result.gefVon') . " " . $ad->gefVon[0] }} </a> </div> <div class="result-subheadline"> <a class="result-link" href="{{ $ad->link }}" target="_blank" referrerpolicy="no-referrer-when-downgrade"> <span>{{ $ad->anzeigeLink }}</span> @if(\App\Localization::getLanguage() === "de") - <img src="/img/100-de.svg" alt="Mark"> + <img src="/img/100-de.svg" alt="Mark"> @else - <img src="/img/100-en.svg" alt="Mark"> + <img src="/img/100-en.svg" alt="Mark"> @endif </a> </div> @@ -34,12 +30,14 @@ </div> </div> <div class="result-footer"> - <a class="result-open-newtab" href="{{ $ad->link }}" target="_blank" rel="noopener" referrerpolicy="no-referrer-when-downgrade" aria-hidden="true" tabindex="-1"> - {!! trans('result.options.6') !!} - </a> - <a class="result-open-key" title="@lang('result.metagerkeytext')" href="{{ app(\App\Models\Authorization\Authorization::class)->getAdfreeLink() }}" target="_blank"> - @lang('result.options.8') - </a> - </div> + <a class="result-open-newtab" href="{{ $ad->link }}" target="_blank" rel="noopener" + referrerpolicy="no-referrer-when-downgrade" aria-hidden="true" tabindex="-1"> + {!! trans('result.options.6') !!} + </a> + <a class="result-open-key" title="@lang('result.metagerkeytext')" + href="{{ app(\App\Models\Authorization\Authorization::class)->getAdfreeLink() }}" target="_blank"> + @lang('result.options.8') + </a> + </div> </div> @endif diff --git a/metager/resources/views/search-engine.blade.php b/metager/resources/views/search-engine.blade.php index 031ef3baee59d882f344c805a4d58831f4414d68..20ff83b1d3b64cc4ae29fb21bc840e14a502d716 100644 --- a/metager/resources/views/search-engine.blade.php +++ b/metager/resources/views/search-engine.blade.php @@ -1,6 +1,6 @@ @extends('layouts.subPages') -@section('title', $title ) +@section('title', $title) @section('content') @@ -9,37 +9,49 @@ <div class="card"> <h2>{{ trans('search-engine.head.2') }}</h2> - <p>{!! trans('search-engine.text.1.1',["transparenz" => LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "transparency")]) !!}</p> + <p>{!! trans('search-engine.text.1.1', ["transparenz" => LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "transparency")]) !!} + </p> <h2>{{ trans('search-engine.head.3') }}</h2> <p>{{ trans('search-engine.text.1.2') }}</p> <p>{!! trans('search-engine.text.1.3', ["contact" => route('contact')]) !!}</p> </div> @foreach($suma_infos as $fokus_name => $suma_list) - <h1>{{ __('index.foki.' . $fokus_name) }}</h2> - <div class="enginecontainer"> + <h1>{{ __('index.foki.' . $fokus_name) }}</h2> + <div class="enginecontainer"> - @foreach($suma_list as $suma_name => $suma_infos) - <div class="card"> - <h2><a href="{{$suma_infos->homepage}}" rel="noopener" target="_blank">{{ $suma_infos->display_name }}<img src="/img/svg-icons/icon-outlink.svg" alt="" aria-hidden="true" id="sidebar-img-outlink"></a></h2> - @if($suma_infos->index_name !== null) - <p><span class="search-engine-dt">{{ trans('search-engine.text.2.2') }}</span>{{ $suma_infos->index_name }}</p> - @endif - @if($suma_infos->founded !== null) - <p><span class="search-engine-dt">{{ trans('search-engine.text.2.3') }}</span>{{ $suma_infos->founded }}</p> - @endif - @if($suma_infos->headquarter !== null) - <p><span class="search-engine-dt">{{ trans('search-engine.text.2.4') }}</span>{{ $suma_infos->headquarter }}</p> - @endif - @if($suma_infos->operator !== null) - <p><span class="search-engine-dt">{{ trans('search-engine.text.2.5') }}</span>{{ $suma_infos->operator }}</p> - @endif - @if($suma_infos->index_size !== null) - <p><span class="search-engine-dt">{{ trans('search-engine.text.2.6') }}</span>{{ $suma_infos->index_size }}</p> - @endif + @foreach($suma_list as $suma_name => $suma_infos) + <div class="card"> + <h2><a href="{{$suma_infos->homepage}}" rel="noopener" + target="_blank">{{ $suma_infos->displayName }}<img src="/img/svg-icons/icon-outlink.svg" alt="" + aria-hidden="true" id="sidebar-img-outlink"></a></h2> + @if($suma_infos->indexName !== null) + <p><span + class="search-engine-dt">{{ trans('search-engine.text.2.2') }}</span>{{ $suma_infos->indexName }} + </p> + @endif + @if($suma_infos->founded !== null) + <p><span class="search-engine-dt">{{ trans('search-engine.text.2.3') }}</span>{{ $suma_infos->founded }} + </p> + @endif + @if($suma_infos->headquarter !== null) + <p><span + class="search-engine-dt">{{ trans('search-engine.text.2.4') }}</span>{{ $suma_infos->headquarter }} + </p> + @endif + @if($suma_infos->operator !== null) + <p><span + class="search-engine-dt">{{ trans('search-engine.text.2.5') }}</span>{{ $suma_infos->operator }} + </p> + @endif + @if($suma_infos->indexSize !== null) + <p><span + class="search-engine-dt">{{ trans('search-engine.text.2.6') }}</span>{{ $suma_infos->indexSize }} + </p> + @endif + </div> + @endforeach </div> - @endforeach - </div> - @endforeach + @endforeach </div> @endsection \ No newline at end of file diff --git a/metager/resources/views/settings/index.blade.php b/metager/resources/views/settings/index.blade.php index 9b8df662dba7ad007d95f5da266f80f77000cfe6..bc17de0b7a9c7744dd4659e551d01644b9362de4 100644 --- a/metager/resources/views/settings/index.blade.php +++ b/metager/resources/views/settings/index.blade.php @@ -127,6 +127,9 @@ @else <p>@lang('settings.cost-free')</p> @endif + @if(array_key_exists("yahoo", $sumas) && $sumas["yahoo"]->configuration->disabled === false) + <p>@lang('settings.hint.yahoo')</p> + @endif </div> @endif @if ($fokus !== 'bilder' || app(App\SearchSettings::class)->external_image_search === 'metager')