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
## 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/)
https://github.com/laravel/laravel
......@@ -26,6 +36,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
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
Other MetaGer source code, unless otherwise noted, is licensed under the AGPL v3 license:
......
......@@ -153,8 +153,6 @@ class LanguageController extends Controller
->with('to', $to)
->with('langTexts', $langTexts)
->with('sum', $sum)
->with('css', 'editLanguage.css')
->with('js', ['editLanguage.js'])
->with('new', $ex["new"]);
}
......
......@@ -47,7 +47,6 @@ class MailController extends Controller
return view('kontakt.kontakt')
->with('title', 'Kontakt')
->with('css', 'kontakt.css')
->with('js', ['openpgp.min.js', 'kontakt.js'])
->with($messageType, $returnMessage);
}
......@@ -109,7 +108,6 @@ class MailController extends Controller
$request->flash();
return view('spende.spende')
->with('title', 'Kontakt')
->with('css', 'donation.css')
->with($messageType, $messageToUser);
} 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')];
......
......@@ -10,7 +10,6 @@ class SitesearchController extends Controller
{
return view('widget.sitesearch')
->with('title', trans('titles.sitesearch'))
->with('css', 'sitesearch.css')
->with('site', $request->input('site', ''))
->with('navbarFocus', 'dienste');
}
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App;
use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
use Response;
class StartpageController extends Controller
{
......@@ -25,7 +26,7 @@ class StartpageController extends Controller
public function loadStartPage(Request $request)
{
$focusPages = [];
$theme = "none";
$theme = "default";
foreach ($request->all() as $key => $value) {
if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') {
$focusPages[] = str_replace('param_', '', $key);
......@@ -50,8 +51,7 @@ class StartpageController extends Controller
->with('focusPages', $focusPages)
->with('browser', $browser)
->with('navbarFocus', 'suche')
->with('theme', $theme)
->with('css', 'index.css');
->with('theme', $theme);
}
public function loadPage($subpage)
......
......@@ -157,6 +157,10 @@ class MetaGer
// combine
$combinedResults = $this->combineResults($engines);
# Wir bestimmen die Sprache eines jeden Suchergebnisses
$this->results = $this->addLangCodes($this->results);
// sort
//$sortedResults = $this->sortResults($engines);
// filter
......@@ -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)
{
foreach ($engines as $engine) {
......@@ -392,9 +442,9 @@ class MetaGer
* Zu Liste hinzufügen
*/
foreach ($sumas as $suma) {
if ($this->sumaIsSelected($suma, $request)
if (($this->sumaIsSelected($suma, $request)
|| (!$this->isBildersuche()
&& $this->sumaIsAdsuche($suma, $overtureEnabled))
&& $this->sumaIsAdsuche($suma, $overtureEnabled)))
&& (!$this->sumaIsDisabled($suma))) {
if ($this->sumaIsOverture($suma)) {
$overtureEnabled = true;
......@@ -812,7 +862,7 @@ class MetaGer
$this->sprueche = false;
}
# 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:
$this->resultCount = $request->input('resultCount', '20');
# Manchmal müssen wir Parameter anpassen um den Sucheinstellungen gerecht zu werden:
......
......@@ -187,12 +187,8 @@ class Result
}
# Eventueller Sprachfilter
if ($metager->getLang() !== "all") {
$text = $this->titel . " " . $this->descr;
$path = app_path() . "/Models/lang.pl";
$lang = exec("echo '$text' | $path");
if ($metager->getLang() !== $lang) {
if ($metager->getLang() !== "all" && isset($this->langCode)) {
if ($metager->getLang() !== $this->langCode) {
return false;
}
......@@ -326,4 +322,14 @@ class Result
{
return $this->rank;
}
public function getLangString()
{
$string = "";
$string .= $this->titel;
$string .= $this->descr;
return $string;
}
}
#!/usr/bin/perl
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
$link = $result->detail_link;
$anzeigeLink = $link;
$descr = $result->description;
$image = $result->svg->url;
$image = $result->svg->png_thumb;
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
......
const elixir = require('laravel-elixir');
require('laravel-elixir-vue-2');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
......@@ -12,8 +10,7 @@ require('laravel-elixir-vue-2');
| file for our application, as well as publishing vendor resources.
|
*/
elixir(mix => {
mix.sass('app.scss')
.webpack('app.js');
});
elixir(function(mix) {
mix.less('default.less', 'public/css/themes/default.css');
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'*/ ]);
});
\ No newline at end of file
......@@ -117,7 +117,7 @@ header ul {
position: fixed;
top: 0;
width: 100%;
height: 45px;
height: 55px;
z-index: 500;
width: 80%;
left: 50%;
......@@ -569,4 +569,4 @@ footer a {
.product img {
max-width: 100px;
}
\ No newline at end of file
}
.content-wrapper {
padding-top: 50px;
}
div#fokiChanger {
margin-bottom: 0;
}
......@@ -33,7 +29,7 @@ p.link {
header nav {
width: 100%;
padding: 0 10px;
padding: 0px 0px;
margin-left: 0;
}
......
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
mark {
background: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
box-sizing: content-box;
height: 0;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-appearance: textfield;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: bold;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
@media print {
*,
*:before,
*:after {
background: transparent !important;
color: #000 !important;
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
.navbar {
display: none;
}
.btn > .caret,
.dropup > .btn > .caret {
border-top-color: #000 !important;
}
.label {
border: 1px solid #000;
}
.table {
border-collapse: collapse !important;
}
.table td,
.table th {
background-color: #fff !important;