diff --git a/app/Http/Controllers/MailController.php b/app/Http/Controllers/MailController.php index c7a1e3c67bad58558a2961b885320336e55bfce9..bcb847e6ecf1c3d9130aa8808378e91bb46dbfc4 100644 --- a/app/Http/Controllers/MailController.php +++ b/app/Http/Controllers/MailController.php @@ -22,7 +22,6 @@ class MailController extends Controller */ public function contactMail(Request $request) { - # Nachricht, die wir an den Nutzer weiterleiten: $messageType = ""; # [success|error] $returnMessage = ''; @@ -52,15 +51,19 @@ class MailController extends Controller if (!$request->filled('message') || !$request->filled('subject')) { $messageType = "error"; - $returnMessage = "Tut uns leid, aber leider haben wir mit Ihrer Kontaktanfrage keine Daten erhalten. Die Nachricht wurde nicht versandt."; + $returnMessage = trans('kontakt.error.1'); } else { # Wir versenden die Mail des Benutzers an uns: + $mailto = "support@metager.org"; + if(LaravelLocalization::getCurrentLocale() === "de"){ + $mailto = "support@suma-ev.de"; + } $message = $request->input('message'); $subject = $request->input('subject'); - Mail::to("support@suma-ev.de") + Mail::to($mailto) ->send(new Kontakt($name, $replyTo, $subject, $message)); - $returnMessage = 'Ihre Nachricht wurde uns erfolgreich zugestellt. Vielen Dank dafür! Wir werden diese schnellstmöglich bearbeiten und uns dann ggf. wieder bei Ihnen melden.'; + $returnMessage = trans('kontakt.success.1'); $messageType = "success"; } diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 7582dbdb78851353794be30ffb12f8704cb66e95..4d594cb5b85cdfd1dc1735fdb0320fb200b551d5 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -61,6 +61,12 @@ class MetaGerSearch extends Controller $timings["checkSpecialSearches"] = microtime(true) - $time; } + # Search query can be empty after parsing the formdata + # we will cancel the search in that case and show an error to the user + if(empty($metager->getQ())){ + return $metager->createView(); + } + if ($spamEntry !== null && Cache::has('spam.' . $metager->getFokus() . "." . md5($spamEntry))) { $responseContent = Cache::get('spam.' . $metager->getFokus() . "." . md5($spamEntry)); $responseContent = preg_replace('/(name="eingabe"\s+value=")[^"]+/', "$1$eingabe", $responseContent); @@ -283,11 +289,12 @@ class MetaGerSearch extends Controller public function quicktips(Request $request) { $search = $request->input('search', ''); + $quotes = $request->input('quotes', 'on'); if(empty($search)){ abort(404); } - $quicktips = new \App\Models\Quicktips\Quicktips($search); + $quicktips = new \App\Models\Quicktips\Quicktips($search, $quotes); return view('quicktips') ->with('quicktips', $quicktips->getResults()) ->with('search', $search); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 49df0a239efb277fc5b56908751ffa51b3e1b7e2..9d1f2f4848436283a28b58c572a0c9da3368ef83 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -192,6 +192,30 @@ class SettingsController extends Controller } + public function enableSetting(Request $request) { + $fokus = $request->input('fokus', ''); + $url = $request->input('url', ''); + // Currently only the setting for quotes is supported + $quotes = $request->input('zitate', ''); + if (empty($fokus) || empty($quotes)) { + abort(404); + } + + if($quotes === "off"){ + $path = \Request::path(); + $cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5); + Cookie::queue($fokus . "_setting_zitate", "off", 0, $cookiePath, null, false, false); + }elseif($quotes === "on") { + $path = \Request::path(); + $cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5); + Cookie::queue($fokus . "_setting_zitate", "", 0, $cookiePath, null, false, false); + }else{ + abort(404); + } + + return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('settings', ["fokus" => $fokus, "url" => $url]))); + } + public function deleteSettings(Request $request) { $fokus = $request->input('fokus', ''); diff --git a/app/MetaGer.php b/app/MetaGer.php index 9954a0bffede405b3baa76bba86391c7fff527e4..247c8104b879aee8d0ffb71fcc5ddb8546e7dc1a 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -244,7 +244,7 @@ class MetaGer ->with('apiAuthorized', $this->apiAuthorized) ->with('metager', $this) ->with('browser', (new Agent())->browser()) - ->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe])) + ->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe, "quotes" => $this->sprueche])) ->with('resultcount', count($this->results)) ->with('focus', $this->fokus); break; @@ -951,13 +951,15 @@ class MetaGer $this->agent = new Agent(); $this->mobile = $this->agent->isMobile(); # Sprüche - $this->sprueche = $request->input('sprueche', 'on'); - if ($this->sprueche === "on") { - $this->sprueche = true; - } else { - $this->sprueche = false; + if (!App::isLocale("de") || (\Cookie::has($this->getFokus() . '_setting_zitate') && \Cookie::get($this->getFokus() . '_setting_zitate') === "off")) { + $this->sprueche = "off"; + }else{ + $this->sprueche = "on"; } - + if($request->filled("zitate") && $request->input('zitate') === "on" || $request->input('zitate') === "off"){ + $this->sprueche = $request->input('quotes'); + } + $this->newtab = $request->input('newtab', 'on'); if ($this->newtab === "on") { $this->newtab = "_blank"; @@ -982,9 +984,7 @@ class MetaGer } $request->replace($newInput); } - if (App::isLocale("en")) { - $this->sprueche = "off"; - } + if ($this->resultCount <= 0 || $this->resultCount > 200) { $this->resultCount = 1000; } diff --git a/app/Models/Quicktips/Quicktips.php b/app/Models/Quicktips/Quicktips.php index 658e0bdd7ce662ad26e9575734e1e3b9f84a8403..ba558afcf9dd0f498c2ae3bf15dec2686f2784f2 100644 --- a/app/Models/Quicktips/Quicktips.php +++ b/app/Models/Quicktips/Quicktips.php @@ -16,7 +16,7 @@ class Quicktips private $hash; - public function __construct($search/*, $locale, $max_time*/) + public function __construct($search, $quotes) { $locale = LaravelLocalization::getCurrentLocale(); if (env("APP_ENV") === "production") { @@ -24,12 +24,12 @@ class Quicktips } else { $this->quicktipUrl = "https://dev.quicktips.metager.de" . $this->quicktipUrl; } - $this->startSearch($search, $locale); + $this->startSearch($search, $quotes, $locale); } - public function startSearch($search, $locale) + public function startSearch($search, $quotes, $locale) { - $url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale; + $url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale . ""es=" . $quotes; $this->hash = md5($url); if (!Cache::has($this->hash)) { diff --git a/init.sh b/init.sh index a668816b25507e21ba39860e9a417e9038aef257..42af2efa729c488cf1e2ab9d83222a6d67111426 100755 --- a/init.sh +++ b/init.sh @@ -2,7 +2,6 @@ # This commands will help initialize data for docker-compose setup # Its supposed to run in a php docker image -docker-php-ext-install pdo pdo_mysql if [ ! -f "/data/.env" ]; then cp /data/.env.example /data/.env @@ -16,10 +15,14 @@ if [ ! -d "/data/storage/logs/metager" ]; then mkdir -p /data/storage/logs/metager fi -touch /data/database/useragents.sqlite +cp /data/database/useragents.sqlite.example /data/database/useragents.sqlite chmod -R go+w storage bootstrap/cache +docker-php-ext-install pdo pdo_mysql + php artisan wait:db -php artisan migrate +rm /data/database/useragents.sqlite +touch /data/database/useragents.sqlite +php artisan migrate:fresh php artisan db:seed \ No newline at end of file diff --git a/resources/js/scriptSettings.js b/resources/js/scriptSettings.js index 144a2ce85ce0db74d07d8ef35c0312e39c6e1731..1c62f16c510d42f1a1467a94df4076b4de2e2356 100644 --- a/resources/js/scriptSettings.js +++ b/resources/js/scriptSettings.js @@ -1,7 +1,6 @@ $(document).ready(function () { - $("#filter-form").find("button[type=submit]").css("display", "none"); - $("#filter-form").find("select").on("change", function () { - $("#filter-form").submit(); + $("#filter-form, #setting-form").find("button[type=submit]").css("display", "none"); + $("#filter-form, #setting-form").find("select").on("change", function () { + $(this).closest('form').submit(); }); - console.log("Test"); }); \ No newline at end of file diff --git a/resources/lang/de/kontakt.php b/resources/lang/de/kontakt.php index ba39413208f384bebb593b59a362bbbfecffeefb..a9e314727262d49925079148e913ed99a1702b40 100644 --- a/resources/lang/de/kontakt.php +++ b/resources/lang/de/kontakt.php @@ -12,7 +12,7 @@ Alternativ können Sie uns natürlich auch per <a href="mailto:support@suma-ev.d 'form.8' => 'Senden', 'mail.1' => 'Per E-Mail', - 'mail.2' => 'Sie können uns auch direkt eine E-Mail an die folgende Adresse schicken: <a href="mailto:office@suma-ev.de">office@suma-ev.de</a>', + 'mail.2' => 'Sie können uns auch direkt eine E-Mail an die folgende Adresse schicken: <a href="mailto::mail">:mail</a>', 'mail.3' => 'Falls Sie diese verschlüsseln wollen, finden Sie nachfolgend unseren öffentlichen OpenPGP-Schlüssel:', 'letter.1' => 'Per Brief-Post', 'letter.2' => 'Wir ziehen es vor, auf digitalem Wege kontaktiert zu werden. @@ -22,4 +22,6 @@ erreichen Sie uns unter der folgenden Adresse:', Röselerstr. 3 30159 Hannover Germany', + 'error.1' => 'Tut uns leid, aber leider haben wir mit Ihrer Kontaktanfrage keine Daten erhalten. Die Nachricht wurde nicht versandt.', + 'success.1' => 'Ihre Nachricht wurde uns erfolgreich zugestellt. Vielen Dank dafür! Wir werden diese schnellstmöglich bearbeiten und uns dann ggf. wieder bei Ihnen melden.' ]; diff --git a/resources/lang/en/kontakt.php b/resources/lang/en/kontakt.php index ad1108f28850dd01cfda7a5e9b62d9e880bc0b53..0bd4f8d6561485ceffb3e2eb59fe50c699101f7e 100644 --- a/resources/lang/en/kontakt.php +++ b/resources/lang/en/kontakt.php @@ -12,7 +12,7 @@ return [ 'form.8' => 'Send', 'mail.1' => 'By Email', - 'mail.2' => 'You can also email us directly at: <a href="mailto:office@suma-ev.de">office@suma-ev.de</a>', + 'mail.2' => 'You can also email us directly at: <a href="mailto::mail">:mail</a>', 'mail.3' => 'If you want to encrypt your email you can use our following public OpenPGP-Key:', 'letter.1' => 'By Letter Mail', 'letter.2' => 'We prefer digital contact. However, if you consider it neccessary to contact us postally, you can mail us at:', @@ -20,4 +20,6 @@ return [ Röselerstr. 3 30159 Hannover Germany', + 'error.1' => 'We are sorry, but unfortunately we did not receive any data with your contact request. The message was not sent.', + 'success.1' => 'Your message was successfully sent to us. Thanks a lot for this! We will process this as soon as possible and then contact you again if necessary.' ]; diff --git a/resources/lang/es/kontakt.php b/resources/lang/es/kontakt.php index 0beb85c62b1b1220c735ad43796aa218dde981cd..27ca5fb7bb51526c86f894918de55c27b3fd2e98 100644 --- a/resources/lang/es/kontakt.php +++ b/resources/lang/es/kontakt.php @@ -11,10 +11,12 @@ return [ "form.8" => "Encriptar y enviar", "mail.1" => "Por email", - "mail.2" => "Nos puede mandar un email directamente a la siguiente direccion: <a href=\"mailto:office@suma-ev.de\">office@suma-ev.de</a>", + "mail.2" => 'Nos puede mandar un email directamente a la siguiente direccion: <a href="mailto::mail">:mail</a>', "mail.3" => "Si la quiere encriptar, puede ver nuestra llave pública de OpenPGP aquÃ:", "letter.1" => "Por carta", "letter.2" => "Preferimos que nos contacte por medios digitales. Si lo ve indispensable contactarnos vÃa correo fisico, nos puede escribir a la siguiente dirección:", "letter.3" => "SUMA-EV Röselerstr. 3 30159 Hannover Germany", + 'error.1' => "Lo sentimos, pero desafortunadamente no recibimos ningún dato con su solicitud de contacto. El mensaje no fue enviado.", + 'success.1' => "Su mensaje nos fue enviado con éxito. ¡Muchas gracias por esto! Procesaremos esto lo antes posible y luego lo contactaremos nuevamente si es necesario." ]; diff --git a/resources/lang/es/plugin-page.php b/resources/lang/es/plugin-page.php index 42b0c7b3bf7e2eed95b801bdd60a2f8386ee91a9..7ed5dd103b0461ab728d64a85749df553bb2434b 100644 --- a/resources/lang/es/plugin-page.php +++ b/resources/lang/es/plugin-page.php @@ -51,5 +51,5 @@ return [ "edge.9" => "En el menú de cascada selecciona \"Definido por el usuario\"", "edge.10" => "En la área abajo ponga \"https://metager.de\" en el campo \"Introducir URL\" y haga click en el sÃmbolo \"+\"", "edge.11" => "Borra todas las entradas, que no quiere abrir al inicio (p.ej. about:start), haciendo click en el pequeño \"x\" a la derecha.", - 'safari.1" => "No pueden añadir otras motores de busqueda alternativas en Safari. "OpenSearch for Safari" y "Glims" soy terminado.', + "safari.1" => "No pueden añadir otras motores de busqueda alternativas en Safari. \"OpenSearch for Safari\" y \"Glims\" soy terminado.", ]; diff --git a/resources/less/metager/pages/resultpage/result-page.less b/resources/less/metager/pages/resultpage/result-page.less index f867141111d0f77f06aa88e65bc8a331cf6adf42..6ac17772dd80bdd7ee152b0316133c992d76c838 100644 --- a/resources/less/metager/pages/resultpage/result-page.less +++ b/resources/less/metager/pages/resultpage/result-page.less @@ -405,6 +405,7 @@ a { #quicktips { height: 100%; width: 100%; + min-height: 500px; iframe{ height: 100%; width: 100%; diff --git a/resources/views/kontakt/kontakt.blade.php b/resources/views/kontakt/kontakt.blade.php index 4bcee3452ee76aa8651533b9a096ede0c002380a..b12d7d37745d73cc9ab63a4dd43f63b867a9d02c 100644 --- a/resources/views/kontakt/kontakt.blade.php +++ b/resources/views/kontakt/kontakt.blade.php @@ -37,7 +37,11 @@ </div> <div class="card-heavy"> <h2>{!! trans('kontakt.mail.1') !!}</h2> - <p>{!! trans('kontakt.mail.2') !!}</p> + @if(LaravelLocalization::getCurrentLocale() === "de") + <p>{!! trans('kontakt.mail.2', ["mail" => "support@suma-ev.de"]) !!}</p> + @else + <p>{!! trans('kontakt.mail.2', ["mail" => "support@metager.org"]) !!}</p> + @endif <p>{!! trans('kontakt.mail.3') !!}</p> <textarea id="pubkey" style="width:50%" rows="8" readonly>@include('kontakt/pgp')</textarea> </div> diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php index 401246309884997e2f820e476d96fd708566a0c5..dab66c36343b7f6fb6f6dc84a14f93a83e97e172 100644 --- a/resources/views/settings/index.blade.php +++ b/resources/views/settings/index.blade.php @@ -84,6 +84,23 @@ </form> </div> + @if(LaravelLocalization::getCurrentLocale() === "de") + <div class="card-light"> + <h2>Weitere Einstellungen</h2> + <form id="setting-form" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('enableSetting')) }}" method="post" class="form"> + <input type="hidden" name="fokus" value="{{ $fokus }}"> + <input type="hidden" name="url" value="{{ $url }}"> + <div class="form-group"> + <label for="zitate">Zitate</label> + <select name="zitate" id="zitate" class="form-control"> + <option value="on" @if(Cookie::get($fokus . "_setting_zitate") === null)disabled selected @endif>Anzeigen</option> + <option value="off" {{ Cookie::get($fokus . "_setting_zitate") === "off" ? "disabled selected" : "" }}>Nicht Anzeigen</option> + </select> + </div> + <button type="submit" class="btn btn-default">@lang('settings.save')</button> + </form> + </div> + @endif <div class="card-light" id="actions"> @if($settingActive) <div id="reset"> diff --git a/routes/cookie.php b/routes/cookie.php index 95ccd1c12ad1d75208df07ac73c83ab3eb3d8f42..8ad3a67810e7f6ddaf5d0547e6c2ffe2bc9238b4 100644 --- a/routes/cookie.php +++ b/routes/cookie.php @@ -18,6 +18,7 @@ Route::group( Route::post('de', 'SettingsController@disableSearchEngine')->name('disableEngine'); Route::post('ee', 'SettingsController@enableSearchEngine')->name('enableEngine'); Route::post('ef', 'SettingsController@enableFilter')->name('enableFilter'); + Route::post('es', 'SettingsController@enableSetting')->name('enableSetting'); Route::post('ds', 'SettingsController@deleteSettings')->name('deleteSettings'); # Route to show and delete all settings