Commit 6fa9d6e2 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch 'development' into 264-metager-testen

parents edd52104 51256296
# Projects used by MetaGer # Projects used by MetaGer
## Non-exhaustive list
| Project | License | Website |
|-----------|-------------|---------------------------|
| Laravel | MIT | https://laravel.com/ |
| Bootstrap | MIT | https://getbootstrap.com/ |
| Our Code | GNU AGPL v3 | https://metager.de |
Above is a table with some (if not all) of the projects that are used.
Below is a list of the full license texts of those projects.
## [Laravel](https://laravel.com/) ## [Laravel](https://laravel.com/)
https://github.com/laravel/laravel https://github.com/laravel/laravel
...@@ -26,6 +36,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ...@@ -26,6 +36,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
--- ---
## [Bootstrap](http://getbootstrap.com/)
https://github.com/twbs/bootstrap/blob/master/LICENSE
The MIT License (MIT)
Copyright (c) 2011-2016 Twitter, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---
# MetaGer source code # MetaGer source code
Other MetaGer source code, unless otherwise noted, is licensed under the AGPL v3 license: Other MetaGer source code, unless otherwise noted, is licensed under the AGPL v3 license:
......
...@@ -153,8 +153,6 @@ class LanguageController extends Controller ...@@ -153,8 +153,6 @@ class LanguageController extends Controller
->with('to', $to) ->with('to', $to)
->with('langTexts', $langTexts) ->with('langTexts', $langTexts)
->with('sum', $sum) ->with('sum', $sum)
->with('css', 'editLanguage.css')
->with('js', ['editLanguage.js'])
->with('new', $ex["new"]); ->with('new', $ex["new"]);
} }
......
...@@ -47,7 +47,6 @@ class MailController extends Controller ...@@ -47,7 +47,6 @@ class MailController extends Controller
return view('kontakt.kontakt') return view('kontakt.kontakt')
->with('title', 'Kontakt') ->with('title', 'Kontakt')
->with('css', 'kontakt.css')
->with('js', ['openpgp.min.js', 'kontakt.js']) ->with('js', ['openpgp.min.js', 'kontakt.js'])
->with($messageType, $returnMessage); ->with($messageType, $returnMessage);
} }
...@@ -109,7 +108,6 @@ class MailController extends Controller ...@@ -109,7 +108,6 @@ class MailController extends Controller
$request->flash(); $request->flash();
return view('spende.spende') return view('spende.spende')
->with('title', 'Kontakt') ->with('title', 'Kontakt')
->with('css', 'donation.css')
->with($messageType, $messageToUser); ->with($messageType, $messageToUser);
} else { } else {
$data = ['name' => $request->input('Name', 'Keine Angabe'), 'telefon' => $request->input('Telefon', 'Keine Angabe'), 'kontonummer' => $request->input('Kontonummer'), 'bankleitzahl' => $request->input('Bankleitzahl'), 'email' => $request->input('email', 'anonymous-user@metager.de'), 'nachricht' => $request->input('Nachricht')]; $data = ['name' => $request->input('Name', 'Keine Angabe'), 'telefon' => $request->input('Telefon', 'Keine Angabe'), 'kontonummer' => $request->input('Kontonummer'), 'bankleitzahl' => $request->input('Bankleitzahl'), 'email' => $request->input('email', 'anonymous-user@metager.de'), 'nachricht' => $request->input('Nachricht')];
......
...@@ -10,7 +10,6 @@ class SitesearchController extends Controller ...@@ -10,7 +10,6 @@ class SitesearchController extends Controller
{ {
return view('widget.sitesearch') return view('widget.sitesearch')
->with('title', trans('titles.sitesearch')) ->with('title', trans('titles.sitesearch'))
->with('css', 'sitesearch.css')
->with('site', $request->input('site', '')) ->with('site', $request->input('site', ''))
->with('navbarFocus', 'dienste'); ->with('navbarFocus', 'dienste');
} }
......
...@@ -5,6 +5,7 @@ namespace App\Http\Controllers; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App; use App;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Jenssegers\Agent\Agent; use Jenssegers\Agent\Agent;
use Response;
class StartpageController extends Controller class StartpageController extends Controller
{ {
...@@ -25,7 +26,7 @@ class StartpageController extends Controller ...@@ -25,7 +26,7 @@ class StartpageController extends Controller
public function loadStartPage(Request $request) public function loadStartPage(Request $request)
{ {
$focusPages = []; $focusPages = [];
$theme = "none"; $theme = "default";
foreach ($request->all() as $key => $value) { foreach ($request->all() as $key => $value) {
if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') { if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') {
$focusPages[] = str_replace('param_', '', $key); $focusPages[] = str_replace('param_', '', $key);
...@@ -50,8 +51,7 @@ class StartpageController extends Controller ...@@ -50,8 +51,7 @@ class StartpageController extends Controller
->with('focusPages', $focusPages) ->with('focusPages', $focusPages)
->with('browser', $browser) ->with('browser', $browser)
->with('navbarFocus', 'suche') ->with('navbarFocus', 'suche')
->with('theme', $theme) ->with('theme', $theme);
->with('css', 'index.css');
} }
public function loadPage($subpage) public function loadPage($subpage)
......
...@@ -157,6 +157,10 @@ class MetaGer ...@@ -157,6 +157,10 @@ class MetaGer
// combine // combine
$combinedResults = $this->combineResults($engines); $combinedResults = $this->combineResults($engines);
# Wir bestimmen die Sprache eines jeden Suchergebnisses
$this->results = $this->addLangCodes($this->results);
// sort // sort
//$sortedResults = $this->sortResults($engines); //$sortedResults = $this->sortResults($engines);
// filter // filter
...@@ -260,6 +264,52 @@ class MetaGer ...@@ -260,6 +264,52 @@ class MetaGer
} }
private function addLangCodes($results)
{
# Wenn es keine Ergebnisse gibt, brauchen wir uns gar nicht erst zu bemühen
if (sizeof($results) === 0) {
return $results;
}
# Bei der Spracheinstellung "all" wird nicht gefiltert
if ($this->getLang() === "all") {
return $results;
} else {
# Ansonsten müssen wir jedem Result einen Sprachcode hinzufügen
$id = 0;
$langStrings = [];
foreach ($results as $result) {
# Wir geben jedem Ergebnis eine ID um später die Sprachcodes zuordnen zu können
$result->id = $id;
$langStrings["result_" . $id] = utf8_encode($result->getLangString());
$id++;
}
# Wir schreiben die Strings in eine temporäre JSON-Datei,
# Da das Array unter umständen zu groß ist für eine direkte Übergabe an das Skript
$filename = "/tmp/" . getmypid();
file_put_contents($filename, json_encode($langStrings));
$langDetectorPath = app_path() . "/Models/lang.pl";
$lang = exec("echo '$filename' | $langDetectorPath");
$lang = json_decode($lang, true);
# Wir haben nun die Sprachcodes der einzelnen Ergebnisse.
# Diese müssen wir nur noch korrekt zuordnen, dann sind wir fertig.
foreach ($lang as $key => $langCode) {
# Prefix vom Key entfernen:
$id = intval(str_replace("result_", "", $key));
foreach ($this->results as $result) {
if ($result->id === $id) {
$result->langCode = $langCode;
break;
}
}
}
return $results;
}
}
public function combineResults($engines) public function combineResults($engines)
{ {
foreach ($engines as $engine) { foreach ($engines as $engine) {
...@@ -392,9 +442,9 @@ class MetaGer ...@@ -392,9 +442,9 @@ class MetaGer
* Zu Liste hinzufügen * Zu Liste hinzufügen
*/ */
foreach ($sumas as $suma) { foreach ($sumas as $suma) {
if ($this->sumaIsSelected($suma, $request) if (($this->sumaIsSelected($suma, $request)
|| (!$this->isBildersuche() || (!$this->isBildersuche()
&& $this->sumaIsAdsuche($suma, $overtureEnabled)) && $this->sumaIsAdsuche($suma, $overtureEnabled)))
&& (!$this->sumaIsDisabled($suma))) { && (!$this->sumaIsDisabled($suma))) {
if ($this->sumaIsOverture($suma)) { if ($this->sumaIsOverture($suma)) {
$overtureEnabled = true; $overtureEnabled = true;
...@@ -812,7 +862,7 @@ class MetaGer ...@@ -812,7 +862,7 @@ class MetaGer
$this->sprueche = false; $this->sprueche = false;
} }
# Theme # Theme
$this->theme = preg_replace("/[^[:alnum:][:space:]]/u", '', $request->input('theme', 'none')); $this->theme = preg_replace("/[^[:alnum:][:space:]]/u", '', $request->input('theme', 'default'));
# Ergebnisse pro Seite: # Ergebnisse pro Seite:
$this->resultCount = $request->input('resultCount', '20'); $this->resultCount = $request->input('resultCount', '20');
# Manchmal müssen wir Parameter anpassen um den Sucheinstellungen gerecht zu werden: # Manchmal müssen wir Parameter anpassen um den Sucheinstellungen gerecht zu werden:
......
...@@ -187,12 +187,8 @@ class Result ...@@ -187,12 +187,8 @@ class Result
} }
# Eventueller Sprachfilter # Eventueller Sprachfilter
if ($metager->getLang() !== "all") { if ($metager->getLang() !== "all" && isset($this->langCode)) {
$text = $this->titel . " " . $this->descr; if ($metager->getLang() !== $this->langCode) {
$path = app_path() . "/Models/lang.pl";
$lang = exec("echo '$text' | $path");
if ($metager->getLang() !== $lang) {
return false; return false;
} }
...@@ -326,4 +322,14 @@ class Result ...@@ -326,4 +322,14 @@ class Result
{ {
return $this->rank; return $this->rank;
} }
public function getLangString()
{
$string = "";
$string .= $this->titel;
$string .= $this->descr;
return $string;
}
} }
#!/usr/bin/perl #!/usr/bin/perl
use Lingua::Identify qw(:language_identification); use Lingua::Identify qw(:language_identification);
use JSON;
use warnings;
use strict;
binmode STDOUT, ":utf8";
binmode STDIN, ":utf8";
use utf8;
$text = <STDIN>; chomp(my $filename = <STDIN>);
$a = langof($text); # Lets open the given file:
open(my $fh, "<", $filename)
or die "Can't open < $filename: $!";
my $json = <$fh>;
close $fh;
print $a; # Decode the JSON String
my $data = decode_json($json);
# Wir durchlaufen den Hash:
foreach my $key (keys %{$data}){
$data->{$key} = langof($data->{$key});
}
$data = encode_json($data);
# Nur noch die temporäre Datei löschen:
unlink($filename);
print $data;
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class Blogsearch extends Searchengine
{
public $results = [];
public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults($result)
{
$result = preg_replace("/\r\n/si", "", $result);
try {
$content = simplexml_load_string($result);
} catch (\Exception $e) {
abort(500, "$result is not a valid xml string");
}
if (!$content) {
return;
}
$results = $content->xpath('//xml/docs/doc');
# die(var_dump($results));
foreach ($results as $result) {
$title = $result->{"title"}->__toString();
$link = $result->{"url"}->__toString();
$anzeigeLink = $link;
$descr = $result->{"content"}->__toString();
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
}
...@@ -32,7 +32,7 @@ class Openclipart extends Searchengine ...@@ -32,7 +32,7 @@ class Openclipart extends Searchengine
$link = $result->detail_link; $link = $result->detail_link;
$anzeigeLink = $link; $anzeigeLink = $link;
$descr = $result->description; $descr = $result->description;
$image = $result->svg->url; $image = $result->svg->png_thumb;
$this->counter++; $this->counter++;
$this->results[] = new \App\Models\Result( $this->results[] = new \App\Models\Result(
$this->engine, $this->engine,
......
const elixir = require('laravel-elixir'); const elixir = require('laravel-elixir');
require('laravel-elixir-vue-2'); require('laravel-elixir-vue-2');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Elixir Asset Management | Elixir Asset Management
...@@ -12,8 +10,7 @@ require('laravel-elixir-vue-2'); ...@@ -12,8 +10,7 @@ require('laravel-elixir-vue-2');
| file for our application, as well as publishing vendor resources. | file for our application, as well as publishing vendor resources.
| |
*/ */
elixir(function(mix) {
elixir(mix => { mix.less('default.less', 'public/css/themes/default.css');
mix.sass('app.scss') mix.scripts(['lib/jquery.js', 'lib/bootstrap.js', 'widgets.js', 'editLanguage.js', 'kontakt.js', 'lib/lightslider.js', 'lib/masonry.js', 'lib/imagesloaded.js', 'lib/openpgp.min.js', 'scriptResultPage.js', 'scriptStartPage.js', 'settings.js' /*, 'lib/vue/app.js', 'lib/vue/bootstrap.js'*/ ]);
.webpack('app.js'); });
}); \ No newline at end of file
...@@ -117,7 +117,7 @@ header ul { ...@@ -117,7 +117,7 @@ header ul {
position: fixed; position: fixed;
top: 0; top: 0;
width: 100%; width: 100%;
height: 45px; height: 55px;
z-index: 500; z-index: 500;
width: 80%; width: 80%;
left: 50%; left: 50%;
...@@ -569,4 +569,4 @@ footer a { ...@@ -569,4 +569,4 @@ footer a {
.product img { .product img {
max-width: 100px; max-width: 100px;
} }
\ No newline at end of file
.content-wrapper {
padding-top: 50px;
}
div#fokiChanger { div#fokiChanger {
margin-bottom: 0; margin-bottom: 0;
} }
...@@ -33,7 +29,7 @@ p.link { ...@@ -33,7 +29,7 @@ p.link {
header nav { header nav {
width: 100%; width: 100%;
padding: 0 10px; padding: 0px 0px;
margin-left: 0; margin-left: 0;
} }
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
body {
background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3) !important;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
* php7.0-zip * php7.0-zip
* sqlite3 * sqlite3
* redis-server * redis-server
* Das Perl-Paket: Lingua::Identify (http://search.cpan.org/~ambs/Lingua-Identify-0.56/lib/Lingua/Identify.pm) * Die Perl-Pakete
* Lingua::Identify (http://search.cpan.org/~ambs/Lingua-Identify-0.56/lib/Lingua/Identify.pm)
* JSON (http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm)
## Offizielle Dokumentation ## Offizielle Dokumentation
......
$(document).ready(function() { $(document).ready(function() {
$(".hint").tooltip(); $(".hint").tooltip();
$("textarea").each(function() { $(".language-text-area").each(function() {
auto_grow(this); auto_grow(this);
}); });
$("textarea").keyup(function() { $(".language-text-area").keyup(function() {
auto_grow(this); auto_grow(this);
}); });
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment