diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 0f3948bedd5095b8238148649a2e15bcd4eae617..c26f1e9572c233f095bf598a341810bb92b957f1 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -6,8 +6,7 @@ use App; use App\MetaGer; use Illuminate\Http\Request; -const TIP_SERVER = 'https://quicktips.metager3.de/tips.xml'; -#const TIP_SERVER = 'http://localhost:63825/tips.xml'; +const TIP_SERVER = 'http://localhost:63825/tips.xml'; class MetaGerSearch extends Controller { @@ -77,7 +76,7 @@ class MetaGerSearch extends Controller public function tips(Request $request) { $tips_text = file_get_contents(TIP_SERVER); - $tips = []; + $tips = []; try { $tips_xml = simplexml_load_string($tips_text); diff --git a/app/MetaGer.php b/app/MetaGer.php index f0dce30a0fc0afa1afcee6e2be612f9b22be25e6..bc8f8a1509f4b82a61716339bc44ae698d24d381 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -54,6 +54,7 @@ class MetaGer protected $domainsBlacklisted = []; protected $urlsBlacklisted = []; protected $url; + protected $fullUrl; protected $languageDetect; protected $verificationId; protected $verificationCount; @@ -304,7 +305,12 @@ class MetaGer } if (count($this->results) <= 0) { - $this->errors[] = trans('metaGer.results.failed'); + if (strlen($this->site) > 0) { + $no_sitesearch_query = str_replace(urlencode("site:" . $this->site), "", $this->fullUrl); + $this->errors[] = trans('metaGer.results.failedSitesearch', ['altSearch' => $no_sitesearch_query]); + } else { + $this->errors[] = trans('metaGer.results.failed'); + } } if ($this->canCache() && isset($this->next) && count($this->next) > 0 && count($this->results) > 0) { @@ -451,10 +457,11 @@ class MetaGer return $results; } - public function humanVerification($results){ + public function humanVerification($results) + { # Let's check if we need to implement a redirect for human verification - if($this->verificationCount > 10){ - foreach($results as $result){ + if ($this->verificationCount > 10) { + foreach ($results as $result) { $link = $result->link; $day = Carbon::now()->day; $pw = md5($this->verificationId . $day . $link . env("PROXY_PASSWORD")); @@ -465,7 +472,7 @@ class MetaGer $result->proxyLink = $proxyUrl; } return $results; - }else{ + } else { return $results; } } @@ -956,6 +963,7 @@ class MetaGer $request->replace($input); } $this->url = $request->url(); + $this->fullUrl = $request->fullUrl(); # Zunächst überprüfen wir die eingegebenen Einstellungen: # Fokus $this->fokus = $request->input('focus', 'web'); diff --git a/app/Models/Quicktips/Quicktip.php b/app/Models/Quicktips/Quicktip.php index 30f9140411a422e4d4cdc1cc6898889548c5492f..4d7201ca2799b6dfef48f94663d37bc5fe076ca9 100644 --- a/app/Models/Quicktips/Quicktip.php +++ b/app/Models/Quicktips/Quicktip.php @@ -9,17 +9,19 @@ class Quicktip public $link; public $gefVonTitle; public $gefVonLink; + public $author; public $descr; public $details; # Erstellt ein neues Ergebnis - public function __construct($type, $title, $link, $gefVonTitle, $gefVonLink, $descr, $details) + public function __construct($type, $title, $link, $gefVonTitle, $gefVonLink, $author, $descr, $details) { $this->type = $type; $this->title = $title; $this->link = $link; $this->gefVonTitle = $gefVonTitle; $this->gefVonLink = $gefVonLink; + $this->author = $author; $this->descr = $descr; $this->details = $details; } diff --git a/app/Models/Quicktips/Quicktips.php b/app/Models/Quicktips/Quicktips.php index 9f6c3dfb52104df0191829b11bfdf177627cbf52..fb395a6e6b087526694bc98f83170d7628a82e25 100644 --- a/app/Models/Quicktips/Quicktips.php +++ b/app/Models/Quicktips/Quicktips.php @@ -12,8 +12,7 @@ class Quicktips { use DispatchesJobs; - //const QUICKTIP_URL = "https://quicktips.metager3.de/quicktips.xml"; - const QUICKTIP_URL = "http://localhost:63825/quicktips.xml"; + const QUICKTIP_URL = "http://localhost:63825/1.1/quicktips.xml"; const QUICKTIP_NAME = "quicktips"; const CACHE_DURATION = 60; @@ -136,6 +135,14 @@ class Quicktips $gefVonLink = ""; } + $quicktip_xml->registerXPathNamespace('mg', 'http://metager.de/opensearch/quicktips/'); + $author = $quicktip_xml->xpath('mg:author'); + if (sizeof($author) > 0) { + $author = $author[0]->__toString(); + } else { + $author = ""; + } + // Description $descr = $quicktip_xml->content->__toString(); @@ -160,6 +167,7 @@ class Quicktips $link, $gefVonTitle, $gefVonLink, + $author, $descr, $details ); diff --git a/resources/assets/less/metager/quicktips.less b/resources/assets/less/metager/quicktips.less index 40eb8e85f6b771d64901e5924e9630b3051cec6c..2c2e8c6b5ca0bf47314ea2ee1b300e34d9cd6699 100644 --- a/resources/assets/less/metager/quicktips.less +++ b/resources/assets/less/metager/quicktips.less @@ -4,142 +4,151 @@ @quicktip-font-medium: @result-font-medium; @quicktip-font-small: @result-font-small; #quicktips { - display: flex; - flex-direction: column; - .quicktip { - .card-light; - position: relative; - details[open=""] .quicktip-extender { - animation-name: quicktip-extender-turn; - animation-fill-mode: forwards; - } - margin: 10px 0px; - padding: 10px 10px 10px 10px; - width: 100%; - border: 1px solid #ccc; - background-color: white; - details:not([open=""]) { - .quicktip-summary p { - .overflow-ellipsis; - } - } - .quicktip-summary { - .quicktip-headline { + display: flex; + flex-direction: column; + .quicktip { + .card-light; + position: relative; + details[open=""] .quicktip-extender { + animation-name: quicktip-extender-turn; + animation-fill-mode: forwards; + } + margin: 10px 0px; + padding: 10px 10px 10px 10px; width: 100%; - display: flex; - justify-content: space-between; - .quicktip-title, - .quicktip-title a { - flex-grow: 0; - margin: 0px 0px 5px 0px; - font-size: 13px; - display: flex; - justify-content: space-between; + border: 1px solid #ccc; + background-color: white; + details:not([open=""]) { + .quicktip-summary p { + .overflow-ellipsis; + } } - .space-taker { - flex-grow: 1; + .quicktip-summary { + .quicktip-headline { + width: 100%; + display: flex; + justify-content: space-between; + .quicktip-title, + .quicktip-title a { + flex-grow: 0; + margin: 0px 0px 5px 0px; + font-size: 13px; + display: flex; + justify-content: space-between; + } + .space-taker { + flex-grow: 1; + } + .quicktip-hoster { + flex-grow: 0; + font-size: @quicktip-font-small; + color: #808080; + white-space: nowrap; + } + .quicktip-extender { + flex-grow: 0; + color: #777; + font-size: 20px; + height: 20px; + font-size: @quicktip-font-large; + } + >* { + margin: 0px 5px; + &:first-child { + margin-left: 0px; + } + &:last-child { + margin-right: 0px; + } + } + } + .result-hoster { + font-size: @result-font-small; + margin-left: 20px; + color: #808080; + white-space: nowrap; + } + p { + font-size: 13px; + } } - .quicktip-hoster { - flex-grow: 0; - font-size: @quicktip-font-small; - color: #808080; - white-space: nowrap; + .quicktip-detail { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + h2 { + margin: 10px 0px; + font-size: 16px; + } + p { + display: none; + font-size: 14px; + } } - .quicktip-extender { - flex-grow: 0; - color: #777; - font-size: 20px; - height: 20px; - font-size: @quicktip-font-large; + &[type="spendenaufruf"] { + order: 100; + border: none; + box-shadow: none; + background-color: inherit; + .quicktip-summary { + display: flex; + justify-content: space-between; + align-items: center; + h1 { + margin: 0px; + } + p { + margin: 5px; + .spendenaufruf-btn { + color: white; + background-color: @link-color; + font-size: 16px; + } + } + } } - > * { - margin: 0px 5px; - &:first-child { - margin-left: 0px; - } - &:last-child { - margin-right: 0px; - } + &[type="spruch"] { + order: 1; + .quicktip-summary { + display: flex; + flex-direction: column; + p { + text-align: justify; + font-style: italic; + quotes: '„' 'â€'; + &:before { + content: open-quote; + } + &:after { + content: close-quote; + } + } + .author { + color: #404040; + align-self: flex-end; + } + } } - } - .result-hoster { - font-size: @result-font-small; - margin-left: 20px; - color: #808080; - white-space: nowrap; - } - p { - font-size: 13px; - } - } - .quicktip-detail { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - h2 { - margin: 10px 0px; - font-size: 16px; - } - p { - display: none; - font-size: 14px; - } - } - &[type="spendenaufruf"] { - order: 100; - border: none; - box-shadow: none; - background-color: inherit; - .quicktip-summary { - display: flex; - justify-content: space-between; - align-items: center; - h1 { - margin: 0px; + &[type="duckDuckGo-bang"] { + order: 2; + .bang-btn { + width: 100%; + margin-top: 5px; + color: #fff; + background-color: #286992; + font-size: 16px; + } } - p { - margin: 5px; - .spendenaufruf-btn { - color: white; - background-color: @link-color; - font-size: 16px; - } + &[type="wikipedia"] { + order: 3; } - } - } - &[type="spruch"] { - order: 1; - p { - display: flex; - flex-direction: column; - text-align: justify; - .author { - color: #404040; - font-style: italic; - align-self: flex-end; + &[type="dictCC"] { + order: 4; + } + &[type="tip"] { + order: 5; + } + &[type="ad"] { + order: 6; } - } - } - &[type="duckDuckGo-bang"] { - order: 2; - .bang-btn { - width: 100%; - margin-top: 5px; - color: #fff; - background-color: #286992; - font-size: 16px; - } - } - &[type="wikipedia"] { - order: 3; - } - &[type="dictCC"] { - order: 4; - } - &[type="tip"] { - order: 5; - } - &[type="ad"] { - order: 6; } - } -} +} \ No newline at end of file diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less index 8979eddcea0b17e6c214b5a93f2fee383ad7f128..80e8e197712a5b76053596ef3782dbf246f61427 100644 --- a/resources/assets/less/metager/result-page.less +++ b/resources/assets/less/metager/result-page.less @@ -586,4 +586,21 @@ footer.resultPageFooter { #resultpage-container-noheader { #resultpage-container; grid-template-areas: "results"; +} + +.metager3-unstable-warning-resultpage { + text-align: center; + position: fixed; + bottom: 0; + margin-bottom: 0px; + width: 100%; +} + +.metager3-unstable-warning { + text-align: center; + position: fixed; + top: 0; + width: 100%; + padding-right: 60px; + padding-left: 150px; } \ No newline at end of file diff --git a/resources/assets/less/metager/sidebar.less b/resources/assets/less/metager/sidebar.less index dec6ccb72481b0c1b94abd21dc8feb74561a6752..48ab8331a0937a3a7d6cab2d23d11c305a924295 100644 --- a/resources/assets/less/metager/sidebar.less +++ b/resources/assets/less/metager/sidebar.less @@ -153,7 +153,7 @@ input#sideBarToggle:checked { line-height: 23px; border-radius: 5px; color: grey; - background-color: white; + background-color: transparent; &:after { content: "≡"; } diff --git a/resources/lang/de/metaGer.php b/resources/lang/de/metaGer.php index 60c52e0acd5f7db3faf4b569beda9b290714658f..4668449ec948619ed7210db39f7b6893e21ccc33 100644 --- a/resources/lang/de/metaGer.php +++ b/resources/lang/de/metaGer.php @@ -1,22 +1,23 @@ <?php return [ - 'results.failed' => 'Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden.', + 'results.failed' => 'Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden.', + 'results.failedSitesearch' => 'Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden. Dies könnte daran liegen, dass Sie aktuell eine Suche ausführen, die sich auf Ergebnisse der Seite ":site" beschränkt. Wenn sie diese beschränkung entfernen möchten, klicken Sie hier: <a href=":altSearch">Neue Suche</a>', - 'settings.noneSelected' => 'Achtung: Sie haben in ihren Einstellungen keine Suchmaschine ausgewählt.', + 'settings.noneSelected' => 'Achtung: Sie haben in ihren Einstellungen keine Suchmaschine ausgewählt.', - 'engines.noParser' => 'Beim Abfragen von :engine ist ein Fehler aufgetreten. Bitte benachrichtigen Sie uns unter: office@suma-ev.de', + 'engines.noParser' => 'Beim Abfragen von :engine ist ein Fehler aufgetreten. Bitte benachrichtigen Sie uns unter: office@suma-ev.de', - 'formdata.cantLoad' => 'Suma-File konnte nicht gefunden werden', - 'formdata.noSearch' => 'Achtung: Sie haben keinen Suchbegriff eingegeben. Sie können ihre Suchbegriffe oben eingeben und es erneut versuchen.', - 'formdata.dartEurope' => 'Hinweis: Sie haben Dart-Europe aktiviert. Die Suche kann deshalb länger dauern und die maximale Suchzeit wurde auf 10 Sekunden hochgesetzt.', - 'formdata.hostBlacklist' => 'Ergebnisse von folgenden Hosts werden nicht angezeigt: ":host"', + 'formdata.cantLoad' => 'Suma-File konnte nicht gefunden werden', + 'formdata.noSearch' => 'Achtung: Sie haben keinen Suchbegriff eingegeben. Sie können ihre Suchbegriffe oben eingeben und es erneut versuchen.', + 'formdata.dartEurope' => 'Hinweis: Sie haben Dart-Europe aktiviert. Die Suche kann deshalb länger dauern und die maximale Suchzeit wurde auf 10 Sekunden hochgesetzt.', + 'formdata.hostBlacklist' => 'Ergebnisse von folgenden Hosts werden nicht angezeigt: ":host"', 'formdata.domainBlacklist' => 'Ergebnisse von folgenden Domains werden nicht angezeigt: ":domain"', - 'formdata.urlBlacklist' => 'Ergebnisse mit URLs, die ":url" beinhalten, werden nicht angezeigt', - 'formdata.stopwords' => 'Sie machen eine Ausschlusssuche. Ergebnisse mit folgenden Wörtern werden nicht angezeigt: ":stopwords"', - 'formdata.phrase' => 'Sie führen eine Phrasensuche durch: :phrase', + 'formdata.urlBlacklist' => 'Ergebnisse mit URLs, die ":url" beinhalten, werden nicht angezeigt', + 'formdata.stopwords' => 'Sie machen eine Ausschlusssuche. Ergebnisse mit folgenden Wörtern werden nicht angezeigt: ":stopwords"', + 'formdata.phrase' => 'Sie führen eine Phrasensuche durch: :phrase', - 'sitesearch.failed' => 'Sie wollten eine Sitesearch auf :site durchführen. Leider unterstützen die eingestellten Suchmaschinen diese nicht. Sie können die Sitesearch im Web-Fokus durchführen. Es werden ihnen Ergebnisse ohne Sitesearch angezeigt.', - 'sitesearch.success' => 'Sie führen eine Sitesearch durch. Es werden nur Ergebnisse von der Seite: ":site" angezeigt.', - 'feedback' => 'Nichts Passendes dabei? Geben Sie uns Feedback: ', + 'sitesearch.failed' => 'Sie wollten eine Sitesearch auf :site durchführen. Leider unterstützen die eingestellten Suchmaschinen diese nicht. Sie können die Sitesearch im Web-Fokus durchführen. Es werden ihnen Ergebnisse ohne Sitesearch angezeigt.', + 'sitesearch.success' => 'Sie führen eine Sitesearch durch. Es werden nur Ergebnisse von der Seite: ":site" angezeigt.', + 'feedback' => 'Nichts Passendes dabei? Geben Sie uns Feedback: ', ]; diff --git a/resources/lang/de/resultPage.php b/resources/lang/de/resultPage.php index e4edd3b8511be116569b9731177f5a1dd7c4facc..204e80cb4a7603013b0e44815e4c69973d552c94 100644 --- a/resources/lang/de/resultPage.php +++ b/resources/lang/de/resultPage.php @@ -3,6 +3,8 @@ return [ 'opensearch' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen', 'startseite' => 'MetaGer-Startseite', - 'impressum' => 'Impressum', - 'search-placeholder' => 'Suchbegriff(e) eingeben' + 'impressum' => 'Impressum', + 'search-placeholder' => 'Suchbegriff(e) eingeben', + 'metager3' => 'Sie befinden sich auf einer MetaGer Testversion. Hier werden Features vor der Veröffentlichung getestet. Unter Umständen funktioniert hier nicht alles wie gewohnt. + Unsere stabile Version finden Sie hier: <a href="https://metager.de" target="_self">metager.de</a>.', ]; diff --git a/resources/views/layouts/resultPage.blade.php b/resources/views/layouts/resultPage.blade.php index 1f3e6635a82e43d9c74e250845d388422b46bb86..99bf006997652e64f2165a1b275c80aea00621fc 100644 --- a/resources/views/layouts/resultPage.blade.php +++ b/resources/views/layouts/resultPage.blade.php @@ -21,9 +21,8 @@ </head> <body id="resultpage-body"> @if(Request::getHttpHost() === "metager3.de") - <div class="alert alert-info" style="text-align: center; position: fixed; bottom: 0;"> - Sie befinden sich auf einer MetaGer Testversion. Hier werden Features vor der Veröffentlichung getestet. Unter Umständen funktioniert hier nicht alles wie gewohnt. - Unsere stabile Version finden Sie <a href="https://metager.de" target="_self">hier</a>. + <div class="alert alert-info metager3-unstable-warning-resultpage"> + {!! @trans('resultPage.metager3') !!} </div> @endif @include('parts.sidebar', ['id' => 'resultPageSideBar']) diff --git a/resources/views/layouts/staticPages.blade.php b/resources/views/layouts/staticPages.blade.php index 826b40e2826ec13df935b8f12d39f183400a9a86..c66748e210495ddd638b31f0d5dd931ec83c7b68 100644 --- a/resources/views/layouts/staticPages.blade.php +++ b/resources/views/layouts/staticPages.blade.php @@ -31,9 +31,8 @@ </head> <body> @if(Request::getHttpHost() === "metager3.de") - <div class="alert alert-info" style="text-align: center;"> - Sie befinden sich auf einer MetaGer Testversion. Hier werden Features vor der Veröffentlichung getestet. Unter Umständen funktioniert hier nicht alles wie gewohnt. - Unsere stabile Version finden Sie <a href="https://metager.de" target="_self">hier</a>. + <div class="alert alert-info metager3-unstable-warning"> + {!! @trans('resultPage.metager3') !!} </div> @endif <header> diff --git a/resources/views/parts/errors.blade.php b/resources/views/parts/errors.blade.php index cf1e826af7b1b00f529177573741d87d2bfc6174..f40b8b0ef270f70b8e273adad4d8abbe7449deac 100644 --- a/resources/views/parts/errors.blade.php +++ b/resources/views/parts/errors.blade.php @@ -3,8 +3,8 @@ <div class="alert alert-danger"> <ul> @foreach($errors as $error) - <li>{{ $error }}</li> + <li>{!! $error !!}</li> @endforeach </ul> </div> -@endif \ No newline at end of file +@endif diff --git a/resources/views/parts/quicktip.blade.php b/resources/views/parts/quicktip.blade.php index 25f6425101606e423d2b8e8481f3473e0a116ae2..08dd26f334af78a72848d779049b398b4f0390cb 100644 --- a/resources/views/parts/quicktip.blade.php +++ b/resources/views/parts/quicktip.blade.php @@ -24,6 +24,9 @@ <i class="quicktip-extender fa fa-chevron-down"></i> </div> <p class="quicktip-description">{!! $quicktip->descr !!}</p> + @if ($quicktip->author != "") + <span class="author">{{ $quicktip->author }}</span> + @endif </summary> @foreach ($quicktip->details as $detail) <div class="quicktip-detail"> @@ -62,5 +65,8 @@ @endif </div> <p>{!! $quicktip->descr !!}</p> + @if ($quicktip->author != "") + <span class="author">{{ $quicktip->author }}</span> + @endif </div> -@endif \ No newline at end of file +@endif