diff --git a/app/Http/Controllers/LogController.php b/app/Http/Controllers/LogController.php index 8a2302ed08898e6b8328393b30fb90f54c79b458..be4b0e7bcbf232f841773735e693ead65362ebfc 100644 --- a/app/Http/Controllers/LogController.php +++ b/app/Http/Controllers/LogController.php @@ -26,4 +26,22 @@ class LogController extends Controller return ''; } + function pluginClose() + { + $redis = Redis::connection('redisLogs'); + if( $redis ) + { + $redis->incr('logs.plugin.close'); + } + } + + function pluginInstall() + { + $redis = Redis::connection('redisLogs'); + if( $redis ) + { + $redis->incr('logs.plugin.install'); + } + } + } \ No newline at end of file diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php index 6a22e7a6f3e4aa3c13279bedcbd179a3efcb7863..0725cc28990486194103244cfa25c3eb43da83e0 100644 --- a/app/Http/Controllers/StartpageController.php +++ b/app/Http/Controllers/StartpageController.php @@ -75,9 +75,10 @@ class StartpageController extends Controller return loadPage($subpage); } - public function loadPlugin(Request $request, $locale = "de") + public function loadPlugin($params, $locale = "de") { - $requests = $request->all(); + $params = unserialize(base64_decode($params)); + $requests = $params; $params = []; foreach($requests as $key => $value) { @@ -94,9 +95,9 @@ class StartpageController extends Controller $params['encoding'] = 'utf8'; if(!isset($params['lang'])) $params['lang'] = 'all'; - $params["eingabe"] = ""; - - + array_forget($params, 'eingabe'); + array_forget($params, 'out'); + array_forget($params, 'page'); $link = action('MetaGerSearch@search', $params); $response = Response::make( diff --git a/app/Http/routes.php b/app/Http/routes.php index f5f64f44097be4c70e74f11dd1479abf8e402450..0943ace43682c62e00d9c1a0818947fcd69b1d67 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -151,10 +151,12 @@ Route::get('meta/meta.ger3', 'MetaGerSearch@search'); Route::get('meta/picture', 'Pictureproxy@get'); Route::get('clickstats', 'LogController@clicklog'); + Route::get('pluginClose', 'LogController@pluginClose'); + Route::get('pluginInstall', 'LogController@pluginInstall'); Route::get('qt', 'MetaGerSearch@quicktips'); Route::get('tips', 'MetaGerSearch@tips'); - Route::get('opensearch.xml', 'StartpageController@loadPlugin'); + Route::get('/plugins/{params}/opensearch.xml', 'StartpageController@loadPlugin'); Route::get('owi', function() { return redirect('https://metager.de/klassik/en/owi/'); diff --git a/app/MetaGer.php b/app/MetaGer.php index 13d095a945f26da1a5b326847a10a9af2f564104..282388c54e449011dc46ebe54de9253c8fb0e3d8 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -107,7 +107,8 @@ class MetaGer ->with('mobile', $this->mobile) ->with('warnings', $this->warnings) ->with('errors', $this->errors) - ->with('metager', $this); + ->with('metager', $this) + ->with('browser', (new Agent())->browser()); default: return view('metager3bilder') ->with('results', $viewResults) @@ -115,7 +116,8 @@ class MetaGer ->with('mobile', $this->mobile) ->with('warnings', $this->warnings) ->with('errors', $this->errors) - ->with('metager', $this); + ->with('metager', $this) + ->with('browser', (new Agent())->browser()); } } @@ -127,7 +129,8 @@ class MetaGer ->with('mobile', $this->mobile) ->with('warnings', $this->warnings) ->with('errors', $this->errors) - ->with('metager', $this); + ->with('metager', $this) + ->with('browser', (new Agent())->browser()); break; case 'results-with-style': return view('metager3') @@ -137,7 +140,8 @@ class MetaGer ->with('warnings', $this->warnings) ->with('errors', $this->errors) ->with('metager', $this) - ->with('suspendheader', "yes"); + ->with('suspendheader', "yes") + ->with('browser', (new Agent())->browser()); break; default: return view('metager3') @@ -145,7 +149,8 @@ class MetaGer ->with('mobile', $this->mobile) ->with('warnings', $this->warnings) ->with('errors', $this->errors) - ->with('metager', $this); + ->with('metager', $this) + ->with('browser', (new Agent())->browser()); break; } } diff --git a/public/css/styleResultPage.css b/public/css/styleResultPage.css index 75f040e5d29716d453bacb02414641700883c3da..ffee0139179a3932564a74af871c40f6050c4678 100644 --- a/public/css/styleResultPage.css +++ b/public/css/styleResultPage.css @@ -36,7 +36,7 @@ nav-tabs > li.active { { } - .alert{ + .tab-pane .alert{ margin: 10px 0; padding: 5px 15px; @@ -461,4 +461,27 @@ footer a{ .pager{ text-align:center; +} + +#searchplugin{ + display:none; + position: fixed; + top: 50px; + right: 10px; + z-index: 501; + width: 25%; +} + +#searchplugin > div{ + text-align: center; + padding-top: 5px; +} +#searchplugin > div > a{ + color: white; +} + +@media(min-width: 768px){ + #searchplugin{ + display: initial; + } } \ No newline at end of file diff --git a/public/js/scriptResultPage.js b/public/js/scriptResultPage.js index bae64e8e5cedae5ab68f5bd28072716fe61d8ddf..aea1f8f11ef6625042aa70985f8bd3f70b16a360 100644 --- a/public/js/scriptResultPage.js +++ b/public/js/scriptResultPage.js @@ -33,6 +33,23 @@ function getDocumentReadyForUse(){ tabs(); theme(); fokiChanger(); + pluginInfo(); +} + +function pluginInfo() +{ + if(localStorage) + { + if(localStorage.getItem('pluginInfo') == "off") + $("#searchplugin").css("display", "none"); + $("#searchplugin").on('close.bs.alert', function() { + $.get('/pluginClose'); + localStorage.setItem('pluginInfo', 'off'); + }); + $("#searchplugin a.btn").click( function() { + $.get('/pluginInstall'); + }); + } } function theme(){ diff --git a/resources/lang/de/index.php b/resources/lang/de/index.php index a2d6b3834c08a13bf5dc3bcbc8e06e6c3cfb6227..0fc9a1d713dced5490fa83f1a0029342f3a6f936 100644 --- a/resources/lang/de/index.php +++ b/resources/lang/de/index.php @@ -33,6 +33,7 @@ return [ 'plugin.head.3' => 'MetaGer zum Opera hinzufügen', 'plugin.head.4' => 'MetaGer zum Internet Explorer hinzufügen', 'plugin.head.5' => 'MetaGer zum Microsoft Edge hinzufügen', + 'plugin.head.info' => '(aktuelle Sucheinstellungen werden übernommen)', 'plugin.firefox.1' => 'Klicken Sie ', 'plugin.firefox.2' => 'hier', @@ -40,15 +41,9 @@ return [ 'plugin.firefox.4' => 'Setzen Sie einen Haken bei "Diese als aktuelle Suchmaschine setzen"', 'plugin.firefox.5' => 'Klicken Sie auf "Hinzufügen"', - 'plugin.chrome.1' => 'Klicken Sie ', - 'plugin.chrome.2' => 'hier', - 'plugin.chrome.3' => ', um MetaGer als Suchmaschine hinzuzufügen', - 'plugin.chrome.4' => 'Klicken Sie im Popup auf OK', - 'plugin.chrome.5' => '(Sollte der OK-Knopf deaktiviert sein, ist MetaGer bereits in Ihren Suchmaschinen. Klicken Sie dann auf Abbrechen und fahren mit Schritt 2 fort.)', - 'plugin.chrome.6' => 'Klicken in Ihrem Browser oben rechts auf ', - 'plugin.chrome.7' => 'Wählen Sie "Einstellungen"', - 'plugin.chrome.8' => 'Im Bereich Suchen, klicken Sie auf "Suchmaschinen verwalten"', - 'plugin.chrome.9' => 'In der nun angezeigten Liste, finden Sie MetaGer. Fahren Sie mit der Maus über den Eintrag und klicken auf "Als Standard festlegen"', + 'plugin.chrome.1' => 'Klicken Sie in Ihrem Chrome oben rechts auf <span class="glyphicon glyphicon-option-vertical"></span> und im folgenden Menü auf "Einstellungen", um die Einstellungen Ihres Chromes zu öffnen.', + 'plugin.chrome.2' => 'Im Bereich "Suchen" klicken Sie auf Suchmaschinen verwalten...', + 'plugin.chrome.3' => 'In der nun angezeigten Liste, finden Sie den Eintrag "MetaGer". Fahren Sie mit der Maus über den Eintrag und klicken auf "Als Standard festlegen"', 'plugin.opera.1' => 'Klicken Sie ', 'plugin.opera.2' => 'hier', diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 3877443023a4355a6b2f5efe6b27556c6ed73b1f..6af261f91c3cd8dc2fd065b2470c9811472cdc01 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -30,6 +30,7 @@ $(".seperator").addClass("hidden"); @endif </h4> + <p class="text-muted">{{ trans('index.plugin.head.info') }}</p> </div> <div class="modal-body"> @if ($browser === 'Firefox' || $browser === 'Mozilla') @@ -40,15 +41,9 @@ </ol> @elseif ($browser === 'Chrome') <ol> - <li>{{ trans('index.plugin.chrome.1') }}<a href="javascript:window.external.AddSearchProvider($('link[rel=search]').attr('href'))" onclick="$('#more').removeClass('hidden');">{{ trans('index.plugin.chrome.2') }}</a>{{ trans('index.plugin.chrome.3') }} - <ul id=\"more\" class=\"hidden list-unstyled\"> - <li>{{ trans('index.plugin.chrome.4') }}</li> - <li><small>{{ trans('index.plugin.chrome.5') }}</small></li> - </ul></li> - <li>{{ trans('index.plugin.chrome.6') }}<span class=\"glyphicon glyphicon-menu-hamburger\"></span></li> - <li>{{ trans('index.plugin.chrome.7') }}</li> - <li>{{ trans('index.plugin.chrome.8') }}</li> - <li>{{ trans('index.plugin.chrome.9') }}</li> + <li>{!! trans('index.plugin.chrome.1') !!}</li> + <li>{!! trans('index.plugin.chrome.2') !!}</li> + <li>{{ trans('index.plugin.chrome.3') }}</li> </ol> @elseif ($browser === 'Opera') <ol> diff --git a/resources/views/layouts/researchandtabs.blade.php b/resources/views/layouts/researchandtabs.blade.php index d1955939fca08c7b1e06300e22c8726d41634680..e38a3fd4d2c0010e27e0031dac066dd1c7ecce8f 100644 --- a/resources/views/layouts/researchandtabs.blade.php +++ b/resources/views/layouts/researchandtabs.blade.php @@ -31,7 +31,16 @@ </ul> </nav> </header> - + @if( strpos(rtrim(Request::header('REFERER'), '/'), LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") ) === 0 && ( Agent::browser() === 'Firefox' || Agent::browser() === 'Mozilla' || Agent::browser() === 'Chrome' || Agent::browser() === 'IE' || $Agent::browser() === 'Edge') ) + <div id="searchplugin" class="alert alert-warning alert-dismissible" role="alert" style=""> + <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> + Wussten Sie, dass Ihr {{ Agent::browser() }} MetaGer als Standardsuchmaschine verwenden kann? + <br /> + <div style=""> + <a href="{{ action('StartpageController@loadStartPage', Request::all()) }}#plugin-modal" target="_blank" type="button" class="btn btn-info" style="">Zeig mir wie</a> + </div> + </div> + @endif <ul class="nav nav-tabs" id="foki" role="tablist"> @if( $metager->getFokus() === "web" ) <li id="webTabSelector" role="presentation" data-loaded="1" class="active"> diff --git a/resources/views/layouts/resultPage.blade.php b/resources/views/layouts/resultPage.blade.php index 11979c10b694127bb65d56d407a561ba15798498..e4a1b2571922fc4501e4e0848da1fa4f95460ee8 100644 --- a/resources/views/layouts/resultPage.blade.php +++ b/resources/views/layouts/resultPage.blade.php @@ -16,6 +16,8 @@ <meta content="{{ $eingabe }}" name="q" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="referrer" content="no-referrer" /> + <link rel="search" type="application/opensearchdescription+xml" title="MetaGer: Sicher suchen & finden, Privatsphäre schützen" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin', ['params' => base64_encode(serialize(Request::all()))])) }}"> + </head> <body id="resultBody"> @if( !isset($suspendheader) ) diff --git a/resources/views/layouts/staticPages.blade.php b/resources/views/layouts/staticPages.blade.php index 35f58fbc98cb364afbe3ccdddb2a7455325be5d6..8691d7a71097aa464d20c76902dc46c3e68d6d65 100644 --- a/resources/views/layouts/staticPages.blade.php +++ b/resources/views/layouts/staticPages.blade.php @@ -14,7 +14,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> <meta rel="icon" type="image/x-icon" href="/favicon.ico" /> <meta rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> - <link rel="search" type="application/opensearchdescription+xml" title="MetaGer: Sicher suchen & finden, Privatsphäre schützen" href="{{ action('StartpageController@loadPlugin', Request::all()) }}"> + <link rel="search" type="application/opensearchdescription+xml" title="MetaGer: Sicher suchen & finden, Privatsphäre schützen" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin', ['params' => base64_encode(serialize(Request::all()))])) }}"> <link href="/css/bootstrap.css" rel="stylesheet" /> <link href="/css/style.css" rel="stylesheet" /> @if (isset($css)) @@ -22,6 +22,7 @@ @endif <link id="theme" href="/css/theme.css.php" rel="stylesheet" /> </head> + <body> <header> <nav class="navbar navbar-default"> diff --git a/resources/views/plugin.blade.php b/resources/views/plugin.blade.php index 197e4f232aa27ad5091b13a8ae7ac030de4bb1c5..f4095e76d31713daed9c0a7d43d21f736692afc3 100644 --- a/resources/views/plugin.blade.php +++ b/resources/views/plugin.blade.php @@ -4,6 +4,6 @@ <Description>MetaGer: Sicher suchen & finden, Privatsphäre schützen</Description> <Contact>office@suma-ev.de</Contact> <Image width="16" height="16" type="image/x-icon">{{ url('/favicon.ico') }}</Image> - <Url type="text/html" template="{{ $link }}{searchTerms}" method="get"></Url> + <Url type="text/html" template="{{ $link }}&eingabe={searchTerms}" method="get"></Url> <InputEncoding>UTF-8</InputEncoding> </OpenSearchDescription> \ No newline at end of file