diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 0def780b6e01606f948af43791ee9d4bb2076d78..0f3948bedd5095b8238148649a2e15bcd4eae617 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -6,6 +6,9 @@ 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'; + class MetaGerSearch extends Controller { public function search(Request $request, MetaGer $metager) @@ -70,4 +73,26 @@ class MetaGerSearch extends Controller $length = strlen($needle); return (substr($haystack, 0, $length) === $needle); } + + public function tips(Request $request) + { + $tips_text = file_get_contents(TIP_SERVER); + $tips = []; + try { + $tips_xml = simplexml_load_string($tips_text); + + $tips_xml->registerXPathNamespace('mg', 'http://metager.de/tips/'); + $tips_xml = $tips_xml->xpath('mg:tip'); + foreach ($tips_xml as $tip_xml) { + $tips[] = $tip_xml->__toString(); + } + } catch (\Exception $e) { + Log::error("A problem occurred loading tips from the tip server."); + Log::error($e->getMessage()); + abort(500); + } + return view('tips') + ->with('title', trans('tips.title')) + ->with('tips', $tips); + } } diff --git a/resources/lang/de/sidebar.php b/resources/lang/de/sidebar.php index 0cafa120b98d1e63d3a4ba83f04b633230fc55a2..61dc1bc673e2feb524b86f196f6f3e1f384c4a2c 100644 --- a/resources/lang/de/sidebar.php +++ b/resources/lang/de/sidebar.php @@ -27,4 +27,5 @@ return [ 'nav25' => 'MetaGer App', 'nav26' => 'MetaGer-Fanshop', 'navigationToggle' => 'Navigation anzeigen', + 'titles.tips' => 'Tips', ]; diff --git a/resources/lang/de/tips.php b/resources/lang/de/tips.php index 30d9df55455a98d1645ac832e92f39b990f49fb1..cb2bed96c34ed3a2a759616a743f5ae9b8a4f293 100644 --- a/resources/lang/de/tips.php +++ b/resources/lang/de/tips.php @@ -1,6 +1,6 @@ <?php return [ - "title" => "MetaGer Tipps, unsortiert - dies & das - wussten Sie schon?", - "shorttitle" => "Wussten Sie schon?" + "title" => "MetaGer Tipps, unsortiert - wussten Sie schon?", + "shorttitle" => "Wussten Sie schon?", ]; diff --git a/resources/views/parts/sidebar.blade.php b/resources/views/parts/sidebar.blade.php index 10fa20a7eda57ab020ef5f033d81f24c0c3f2888..ed5e2fbf4dd6c03460f94ce2cdb5a8adc17bcca8 100644 --- a/resources/views/parts/sidebar.blade.php +++ b/resources/views/parts/sidebar.blade.php @@ -29,16 +29,16 @@ <a class="inlink" href="https://metager.de/klassik/asso/" tabindex="228">{{ trans('sidebar.nav11') }}</a> </li> <li> - <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/app/") }}" tabindex="230">@lang('sidebar.nav25')</a> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/app/") }}" tabindex="229">@lang('sidebar.nav25')</a> </li> <li> - <a class="inlink" href="https://metager.to/" tabindex="231">{{ trans('sidebar.nav13') }}</a> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/tips/") }}" tabindex="230">{{ trans('sidebar.titles.tips') }}</a> </li> <li> - <a class="inlink" href="https://maps.metager.de" target="_blank" tabindex="232">Maps.MetaGer.de</a> + <a class="inlink" href="https://maps.metager.de" target="_blank" tabindex="231">Maps.MetaGer.de</a> </li> <li> - <a class="outlink" href="https://gitlab.metager3.de/open-source/MetaGer" tabindex="233">{{ trans('sidebar.nav24') }}</a> + <a class="outlink" href="https://gitlab.metager3.de/open-source/MetaGer" tabindex="232">{{ trans('sidebar.nav24') }}</a> </li> <li> <a class="outlink" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/tor/") }}" tabindex="234">{{ trans('sidebar.nav14') }}</a> diff --git a/resources/views/tips.blade.php b/resources/views/tips.blade.php index 85efd7c9c11fa28a994e7ac57c0b1e1cd2c49b8e..1ed2edf7c05506d1066ac3a8ed6bfb4479746b81 100644 --- a/resources/views/tips.blade.php +++ b/resources/views/tips.blade.php @@ -1,12 +1,16 @@ -@extends('layouts.staticPages') +@extends('layouts.subPages') @section('title', $title ) +@section('navbarFocus.tips', 'class="active"') + @section('content') - <h1>{!! trans('tips.title') !!}</h1> - <ol> - @foreach( $tips as $tip ) - <li>{!! $tip !!}</li> - @endforeach - </ol> + <h1 class="page-title">{!! trans('tips.title') !!}</h1> + <div class="card-heavy"> + <ol> + @foreach( $tips as $tip ) + <li>{!! $tip !!}</li> + @endforeach + </ol> + </div> @endsection