web.php 9.77 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
<?php

3
4
use Jenssegers\Agent\Agent;

Dominik Hebeler's avatar
Dominik Hebeler committed
5
6
/*
|--------------------------------------------------------------------------
7
| Web Routes
Dominik Hebeler's avatar
Dominik Hebeler committed
8
9
|--------------------------------------------------------------------------
|
10
11
12
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
Dominik Hebeler's avatar
Dominik Hebeler committed
13
|
14
15
16
17
18
19
20
21
 */
Route::group(
    [
        'prefix' => LaravelLocalization::setLocale(), /*,
    'middleware' => [ 'localeSessionRedirect', 'localizationRedirect' ]*/
    ],
    function () {
        /** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
22

23
        Route::get('/', 'StartpageController@loadStartPage');
Dominik Hebeler's avatar
Dominik Hebeler committed
24
25
26
        Route::get('sand', function () {
            abort(500, "test");
        });
27
        Route::get('asso', function () {
28
29
30
            return view('assoziator.asso')
                ->with('title', trans('titles.asso'))
                ->with('navbarFocus', 'dienste');
31
32
        });
        Route::post('asso', 'Assoziator@asso');
33

34
35
36
37
38
39
40
41
        Route::get('impressum', function () {
            return view('impressum')
                ->with('title', trans('titles.impressum'))
                ->with('navbarFocus', 'kontakt');
        });
        Route::get('impressum.html', function () {
            return redirect(url('impressum'));
        });
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
        Route::get('about', function () {
            return view('about')
                ->with('title', trans('titles.about'))
                ->with('navbarFocus', 'kontakt');
        });
        Route::get('team', function () {
            return view('team.team')
                ->with('title', trans('titles.team'))
                ->with('navbarFocus', 'kontakt');
        });
        Route::get('team/pubkey-wsb', function () {
            return view('team.pubkey-wsb')
                ->with('title', trans('titles.team'))
                ->with('navbarFocus', 'kontakt');
        });
58

59
        Route::get('kontakt/{url?}', function ($url = "") {
60
61
            return view('kontakt.kontakt')
                ->with('title', trans('titles.kontakt'))
62
                ->with('navbarFocus', 'kontakt')
63
                ->with('url', $url);
64
        });
Dominik Hebeler's avatar
Dominik Hebeler committed
65

66
        Route::post('kontakt', 'MailController@contactMail');
67

68
69
70
71
72
73
74
75
76
77
        Route::get('tor', function () {
            return view('tor')
                ->with('title', 'tor hidden service - MetaGer')
                ->with('navbarFocus', 'dienste');
        });
        Route::get('spende', function () {
            return view('spende.spende')
                ->with('title', trans('titles.spende'))
                ->with('navbarFocus', 'foerdern');
        });
78
        Route::get('spende/danke/{data}', ['as' => 'danke', function ($data) {
79
80
81
82
            return view('spende.danke')
                ->with('title', trans('titles.spende'))
                ->with('navbarFocus', 'foerdern')
                ->with('data', unserialize(base64_decode($data)));
83
        }]);
84
85
86
        Route::get('partnershops', function () {
            return view('spende.partnershops')
                ->with('title', trans('titles.partnershops'))
87
                ->with('navbarFocus', 'foerdern');
88
        });
89

90
        Route::get('beitritt', function () {
91
            if (LaravelLocalization::getCurrentLocale() === "de") {
92
                return response()->download(storage_path('app/public/aufnahmeantrag-de.pdf'), "SUMA-EV_Beitrittsformular_" . (new \DateTime())->format("Y_m_d") . ".pdf", ["Content-Type" => "application/pdf"]);
93
            } else {
94
                return response()->download(storage_path('app/public/aufnahmeantrag-en.pdf'), "SUMA-EV_Membershipform_" . (new \DateTime())->format("Y_m_d") . ".pdf", ["Content-Type" => "application/pdf"]);
95
            }
96
        });
97

98
99
100
        Route::get('bform1.htm', function () {
            return redirect('beitritt');
        });
101

102
        Route::post('spende', 'MailController@donation');
103

104
        Route::get('datenschutz', function () {
105
            return view('datenschutz/datenschutz')
106
107
108
                ->with('title', trans('titles.datenschutz'))
                ->with('navbarFocus', 'datenschutz');
        });
Dominik Hebeler's avatar
Dominik Hebeler committed
109

110
111
112
        Route::get('hilfe', function () {
            return view('hilfe')
                ->with('title', trans('titles.hilfe'))
113
114
                ->with('navbarFocus', 'hilfe');
        });
115

Karl Hasselbring's avatar
Karl Hasselbring committed
116
        Route::get('hilfe/faktencheck', function () {
117
118
119
120
121
            return view('faktencheck')
                ->with('title', trans('titles.faktencheck'))
                ->with('navbarFocus', 'hilfe');
        });

122
        Route::get('faq', function () {
Dominik Hebeler's avatar
Dominik Hebeler committed
123
            return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), '/hilfe'));
124
        });
125

126
        Route::get('widget', function () {
127
            return view('widget.widget')
128
129
                ->with('title', trans('titles.widget'))
                ->with('navbarFocus', 'dienste');
karl's avatar
karl committed
130
        });
131
132
133

        Route::get('sitesearch', 'SitesearchController@loadPage');

134
        Route::get('websearch', function () {
135
136
            return view('widget.websearch')
                ->with('title', trans('titles.websearch'))
137
                ->with('navbarFocus', 'dienste');
138
139
        });

140
141
        Route::get('zitat-suche', 'ZitatController@zitatSuche');

Karl Hasselbring's avatar
Karl Hasselbring committed
142
143
144
145
146
        Route::get('jugendschutz', function () {
            return view('jugendschutz')
                ->with('title', trans('titles.jugendschutz'));
        });

Karl Hasselbring's avatar
Karl Hasselbring committed
147
148
149
150
151
        Route::get('ad-info', function () {
            return view('ad-info')
                ->with('title', trans('titles.ad-info'));
        });

Karl Hasselbring's avatar
Karl Hasselbring committed
152
153
154
155
156
157
158
159
160
161
162
163
        Route::get('age.xml', function () {
            $response = Response::make(file_get_contents(resource_path('age/age.xml')));
            $response->header('Content-Type', "application/xml");
            return $response;
        });

        Route::get('age-de.xml', function () {
            $response = Response::make(file_get_contents(resource_path('age/age-de.xml')));
            $response->header('Content-Type', "application/xml");
            return $response;
        });

164
165
166
167
168
169
170
171
        Route::get('plugin', function () {
            return view('plugin-page')
                ->with('title', trans('titles.plugin'))
                ->with('navbarFocus', 'dienste')
                ->with('browser', (new Agent())->browser())
                ->with('request', $this->input('request', 'GET'));
        });

Dominik Hebeler's avatar
Dominik Hebeler committed
172
        Route::group(['middleware' => ['auth.basic'], 'prefix' => 'admin'], function () {
173
            Route::get('/', 'AdminInterface@index');
Karl Hasselbring's avatar
Karl Hasselbring committed
174
            Route::match(['get', 'post'], 'count', 'AdminInterface@count');
Dominik Hebeler's avatar
Dominik Hebeler committed
175
            Route::get('timings', 'MetaGerSearch@searchTimings');
Dominik Hebeler's avatar
Dominik Hebeler committed
176
            Route::get('count/graphtoday.svg', 'AdminInterface@countGraphToday');
Dominik Hebeler's avatar
Dominik Hebeler committed
177
            Route::get('engine/stats.json', 'AdminInterface@engineStats');
178
179
            Route::get('check', 'AdminInterface@check');
            Route::get('engines', 'AdminInterface@engines');
Dominik Hebeler's avatar
Dominik Hebeler committed
180
            Route::get('ip', function () {
Dominik Hebeler's avatar
Dominik Hebeler committed
181
                dd(Request::ip(), $_SERVER["AGENT"]);
Dominik Hebeler's avatar
Dominik Hebeler committed
182
            });
183
        });
Dominik Hebeler's avatar
Dominik Hebeler committed
184

185
186
187
        Route::get('settings', function () {
            return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), '/'));
        });
karl's avatar
karl committed
188

189
        Route::match(['get', 'post'], 'meta/meta.ger3', 'MetaGerSearch@search')->middleware('humanverification', 'useragentmaster');
Dominik Hebeler's avatar
Dominik Hebeler committed
190

191
        Route::get('meta/loadMore', 'MetaGerSearch@loadMore');
Dominik Hebeler's avatar
Dominik Hebeler committed
192
193
        Route::post('img/cat.jpg', 'HumanVerification@remove');
        Route::get('r/metager/{mm}/{pw}/{url}', ['as' => 'humanverification', 'uses' => 'HumanVerification@removeGet']);
194
        Route::post('img/dog.jpg', 'HumanVerification@whitelist');
Karl Hasselbring's avatar
Karl Hasselbring committed
195

196
197
198
199
        Route::get('meta/picture', 'Pictureproxy@get');
        Route::get('clickstats', 'LogController@clicklog');
        Route::get('pluginClose', 'LogController@pluginClose');
        Route::get('pluginInstall', 'LogController@pluginInstall');
200

201
202
        Route::get('qt', 'MetaGerSearch@quicktips');
        Route::get('tips', 'MetaGerSearch@tips');
203
        Route::get('/plugins/opensearch.xml', 'StartpageController@loadPlugin');
204
205
206
        Route::get('owi', function () {
            return redirect('https://metager.de/klassik/en/owi/');
        });
Dominik Hebeler's avatar
Dominik Hebeler committed
207
208
209
210
211
212
        Route::get('MG20', function () {
            return redirect('https://metager.de/klassik/MG20');
        });
        Route::get('databund', function () {
            return redirect('https://metager.de/klassik/databund');
        });
213
        Route::get('languages', 'LanguageController@createOverview');
214
        Route::get('synoptic/{exclude?}/{chosenFile?}', 'LanguageController@createSynopticEditPage');
215
        Route::post('synoptic/{exclude?}/{chosenFile?}', 'LanguageController@processSynopticPageInput');
216
        Route::get('languages/edit/{from}/{to}/{exclude?}/{email?}', 'LanguageController@createEditPage');
Aria Givi's avatar
Aria Givi committed
217
        Route::post('languages/edit/{from}/{to}/{exclude?}/{email?}', 'MailController@sendLanguageFile');
218
219
220
221
222
223
224
225

        Route::group(['prefix' => 'app'], function () {
            Route::get('/', function () {
                return view('app')
                    ->with('title', trans('titles.app'))
                    ->with('navbarFocus', 'dienste');
            });
            Route::get('metager', function () {
226
                return redirect("https://gitlab.metager.de/open-source/app-en/raw/latest/app/release/app-release.apk?inline=false");
227
228
            });
            Route::get('maps', function () {
229
                return redirect("https://gitlab.metager.de/open-source/metager-maps-android/raw/latest/app/release/app-release.apk?inline=false");
230
            });
Dominik Hebeler's avatar
Dominik Hebeler committed
231

Dominik Hebeler's avatar
Dominik Hebeler committed
232
            Route::get('maps/version', function () {
233
                $filePath = env('maps_version');
Dominik Hebeler's avatar
Dominik Hebeler committed
234
235
236
237
                $fileContents = file_get_contents($filePath);
                return response($fileContents, 200)
                    ->header('Content-Type', 'text/plain');
            });
238
        });
239
    });