Commit a53559e0 authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Merge branch 'development' into 513-css-dateien-aufraumen

parents f80cc88f b1e1e657
......@@ -51,7 +51,6 @@ class Searcher implements ShouldQueue
$this->counter = 0; // Counts the number of answered jobs
$time = microtime(true);
while(true){
Log:info("Durchlauf");
// Update the expire
Redis::expire($this->name, 5);
Redis::expire($this->name . ".stats", 5);
......
......@@ -24,6 +24,7 @@ class MetaGer
protected $site;
protected $hostBlacklist = [];
protected $domainBlacklist = [];
private $urlBlacklist = [];
protected $stopWords = [];
protected $phrases = [];
protected $engines = [];
......@@ -1008,12 +1009,13 @@ class MetaGer
$this->searchCheckSitesearch($site);
$this->searchCheckHostBlacklist();
$this->searchCheckDomainBlacklist();
$this->searchCheckUrlBlacklist();
$this->searchCheckPhrase();
$this->searchCheckStopwords();
$this->searchCheckNoSearch();
}
public function searchCheckSitesearch($site)
private function searchCheckSitesearch($site)
{
// matches '[... ]site:test.de[ ...]'
while (preg_match("/(^|.+\s)site:(\S+)(?:\s(.+)|($))/si", $this->q, $match)) {
......@@ -1025,13 +1027,14 @@ class MetaGer
}
}
public function searchCheckHostBlacklist()
private function searchCheckHostBlacklist()
{
// matches '[... ]-site:test.de[ ...]'
while (preg_match("/(^|.+\s)-site:([^\s\*]\S*)(?:\s(.+)|($))/si", $this->q, $match)) {
$this->hostBlacklist[] = $match[2];
$this->q = $match[1] . $match[3];
}
// print the host blacklist as a user warning
if (sizeof($this->hostBlacklist) > 0) {
$hostString = "";
foreach ($this->hostBlacklist as $host) {
......@@ -1042,13 +1045,14 @@ class MetaGer
}
}
public function searchCheckDomainBlacklist()
private function searchCheckDomainBlacklist()
{
// matches '[... ]-site:*.test.de[ ...]'
while (preg_match("/(^|.+\s)-site:\*\.(\S+)(?:\s(.+)|($))/si", $this->q, $match)) {
$this->domainBlacklist[] = $match[2];
$this->q = $match[1] . $match[3];
}
// print the domain blacklist as a user warning
if (sizeof($this->domainBlacklist) > 0) {
$domainString = "";
foreach ($this->domainBlacklist as $domain) {
......@@ -1059,13 +1063,32 @@ class MetaGer
}
}
public function searchCheckStopwords()
private function searchCheckUrlBlacklist()
{
// matches '[... ]-site:*.test.de[ ...]'
while (preg_match("/(^|.+\s)-url:(\S+)(?:\s(.+)|($))/si", $this->q, $match)) {
$this->urlBlacklist[] = $match[2];
$this->q = $match[1] . $match[3];
}
// print the url blacklist as a user warning
if (sizeof($this->urlBlacklist) > 0) {
$urlString = "";
foreach ($this->urlBlacklist as $url) {
$urlString .= $url . ", ";
}
$urlString = rtrim($urlString, ", ");
$this->warnings[] = trans('metaGer.formdata.urlBlacklist', ['url' => $urlString]);
}
}
private function searchCheckStopwords()
{
// matches '[... ]-test[ ...]'
while (preg_match("/(^|.+\s)-(\S+)(?:\s(.+)|($))/si", $this->q, $match)) {
$this->stopWords[] = $match[2];
$this->q = $match[1] . $match[3];
}
// print the stopwords as a user warning
if (sizeof($this->stopWords) > 0) {
$stopwordsString = "";
foreach ($this->stopWords as $stopword) {
......@@ -1076,7 +1099,7 @@ class MetaGer
}
}
public function searchCheckPhrase()
private function searchCheckPhrase()
{
$p = "";
$tmp = $this->q;
......@@ -1094,7 +1117,7 @@ class MetaGer
}
}
public function searchCheckNoSearch()
private function searchCheckNoSearch()
{
if ($this->q === "") {
$this->warnings[] = trans('metaGer.formdata.noSearch');
......@@ -1433,6 +1456,11 @@ class MetaGer
return $this->domainBlacklist;
}
public function getUserUrlBlacklist()
{
return $this->urlBlacklist;
}
public function getDomainBlacklist()
{
return $this->domainsBlacklisted;
......
......@@ -216,12 +216,17 @@ class Result
# Überprüft ob das Ergebnis aus irgendwelchen Gründen unerwünscht ist.
public function isValid(\App\MetaGer $metager)
{
# Perönliche URL und Domain Blacklist
if (in_array($this->strippedHost, $metager->getUserHostBlacklist())
|| in_array($this->strippedDomain, $metager->getUserDomainBlacklist())) {
# Perönliche Host und Domain Blacklist
if (in_array(strtolower($this->strippedHost), $metager->getUserHostBlacklist())
|| in_array(strtolower($this->strippedDomain), $metager->getUserDomainBlacklist())) {
return false;
}
# Persönliche URL Blacklist
foreach ($metager->getUserUrlBlacklist() as $word) {
if (strpos(strtolower($this->link), $word)) return false;
}
# Allgemeine URL und Domain Blacklist
if ($this->strippedHost !== "" && (in_array($this->strippedHost, $metager->getDomainBlacklist()) || in_array($this->strippedLink, $metager->getUrlBlacklist()))) {
return false;
......
......@@ -22,7 +22,7 @@ elixir(function (mix) {
| scriptStartPage.js
| settings.js
*/
mix.scripts(['lib/jquery.js', 'lib/bootstrap.js', 'lib/lightslider.js', 'lib/masonry.js', 'lib/imagesloaded.js', 'lib/openpgp.min.js', 'lib/iframeResizer.min.js'], 'public/js/lib.js')
mix.scripts(['lib/jquery.js', 'lib/jquery-ui.min.js', 'lib/bootstrap.js', 'lib/lightslider.js', 'lib/masonry.js', 'lib/imagesloaded.js', 'lib/openpgp.min.js', 'lib/iframeResizer.min.js', 'lib/md5.js'], 'public/js/lib.js')
mix.scripts(['lib/jquery.js', 'lib/iframeResizer.contentWindow.min.js'], 'public/js/quicktips.js')
mix.version(['css/themes/default.css', 'js/lib.js', 'js/quicktips.js'])
mix.less('metager/beitritt.less', 'public/css/beitritt.css')
......
This diff is collapsed.
$(document).ready(function () {
$('.hint').tooltip();
$('.language-text-area').each(function () {
auto_grow(this);
});
$('.language-text-area').keyup(function () {
auto_grow(this);
});
});
function auto_grow (element) {
element.style.height = '5px';
element.style.height = (element.scrollHeight + 10) + 'px';
}
$(document).ready(function() {
$(".hint").tooltip();
$(".language-text-area").each(function() {
auto_grow(this);
});
$(".language-text-area").keyup(function() {
auto_grow(this);
});
});
function auto_grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight + 10) + "px";
}
\ No newline at end of file
$(document).ready(function() {
switch (getLanguage()) {
case "de":
$(".encrypt-btn").html("Verschlüsseln und senden");
break;
case "en":
$(".encrypt-btn").html("encrypt and send");
break;
case "es":
// $(".encrypt-btn").html(""); TODO
break;
}
$(".contact").submit(function() {
return encrypt(this);
});
$(document).ready(function () {
switch (getLanguage()) {
case 'de':
$('.encrypt-btn').html('Verschlüsseln und senden');
break;
case 'en':
$('.encrypt-btn').html('encrypt and send');
break;
case 'es':
// $(".encrypt-btn").html(""); TODO
break;
}
$('.contact').submit(function () {
return encrypt(this);
});
});
//based on https://github.com/encrypt-to/secure.contactform.php
// based on https://github.com/encrypt-to/secure.contactform.php
/* The MIT License (MIT)
Copyright (c) 2013 Jan Wiegelmann
......@@ -32,39 +32,39 @@ 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.*/
function encrypt() {
if (window.crypto && window.crypto.getRandomValues) {
var message = document.getElementById("message");
if (message.value.indexOf("-----BEGIN PGP MESSAGE-----") !== -1 && message.value.indexOf("-----END PGP MESSAGE-----") !== -1) {
// encryption done
} else {
var pub_key = openpgp.key.readArmored(document.getElementById("pubkey").innerHTML).keys[0];
var plaintext = message.value;
var ciphertext = openpgp.encryptMessage([pub_key], plaintext);
message.value = ciphertext;
return true;
}
function encrypt () {
if (window.crypto && window.crypto.getRandomValues) {
var message = document.getElementById('message');
if (message.value.indexOf('-----BEGIN PGP MESSAGE-----') !== -1 && message.value.indexOf('-----END PGP MESSAGE-----') !== -1) {
// encryption done
} else {
switch (getLanguage()) {
case "de":
alert("Fehler: Ihr Browser wird nicht unterstützt. Bitte installieren Sie einen aktuellen Browser wie z.B. Mozilla Firefox.");
break;
case "en":
alert("Error: Your browser is not supported. Please install an up to date browser like Mozilla Firefox.");
break;
case "es":
// alert(""); TODO
break;
}
return false;
var pub_key = openpgp.key.readArmored(document.getElementById('pubkey').innerHTML).keys[0];
var plaintext = message.value;
var ciphertext = openpgp.encryptMessage([pub_key], plaintext);
message.value = ciphertext;
return true;
}
} else {
switch (getLanguage()) {
case 'de':
alert('Fehler: Ihr Browser wird nicht unterstützt. Bitte installieren Sie einen aktuellen Browser wie z.B. Mozilla Firefox.');
break;
case 'en':
alert('Error: Your browser is not supported. Please install an up to date browser like Mozilla Firefox.');
break;
case 'es':
// alert(""); TODO
break;
}
return false;
}
}
function getLanguage() {
var metaData = document.getElementsByTagName('meta');
for (var m in metaData) {
if (metaData[m]["httpEquiv"] == "language") {
return metaData[m]["content"];
}
function getLanguage () {
var metaData = document.getElementsByTagName('meta');
for (var m in metaData) {
if (metaData[m]['httpEquiv'] == 'language') {
return metaData[m]['content'];
}
}
\ No newline at end of file
}
}
This diff is collapsed.
$(document).ready(function () {
// Wenn LocalStorage verfügbar ist, geben wir die Möglichkeit die Einstellungen dort zu speichern
tickOptions();
if (localStorage) {
$('#save').removeClass('hidden');
$('#save').click(function () {
localStorage.setItem('pers', true);
$('input[type=checkbox]:checked, input[type=hidden]').each(function (el) {
localStorage.setItem($(this).attr('name'), $(this).val());
});
$('select').each(function (el) {
localStorage.setItem($(this).attr('name'), $(this).val());
});
document.location.href = $('#save').attr('data-href');
});
}
$('.checker').click(function () {
var selector = '.' + $(this).attr('data-type');
if ($(selector + ' input:checked').length) {
$(selector + ' input').prop('checked', false);
} else {
$(selector + ' input').prop('checked', true);
}
});
$('#unten').click(function () {
$('#settings-form').append('<input type="hidden" name="usage" value="once">');
switch (getLanguage()) {
case 'de':
alert('Auf der folgenden Startseite sind Ihre Einstellungen nun einmalig gespeichert. Nach Ihrer ersten Suche sind diese wieder verloren. Wenn Sie diese speichern möchten, können Sie sich allerdings ein Lesezeichen für die generierte Startseite einrichten.');
break;
case 'en':
alert('On the following startpage your settings are saved one-time. They will be lost after your first search. Though if you want to save them, you can create a bookmark for the generated startpage.');
break;
case 'es':
// alert(""); TODO
break;
}
});
$('#plugin').click(function () {
$('form').attr('action', $('#save').attr('data-href') + '#plugin-modal');
switch (getLanguage()) {
case 'de':
alert('Ihr Browserplugin mit den persönlichen Sucheinstellungen wurde generiert. Folgen Sie bitte der Anleitung auf der folgenden Seite um es zu installieren. Beachten Sie: Zuvor sollten Sie ein eventuell bereits installiertes MetaGer-Plugin entfernen.');
break;
case 'en':
alert('Your browser plugin with personal settings was generated. Please follow the instructions on the following page to install it. Notice that beforehand you might have to delete a former MetaGer plugin.');
break;
case 'es':
// alert(""); TODO
break;
}
});
$('#settings-focus').val('angepasst');
});
function tickOptions () {
if (localStorage && localStorage.getItem('pers')) {
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith('param_')) {
if ($('input[name=' + key + ']').length) {
$('input[name=' + key + ']').attr('checked', '');
} else {
$('select[name=' + key + '] > option[value=' + value + ']').attr('selected', true);
}
}
}
} else {
$('div.web input').attr('checked', true);
}
}
function getLanguage () {
var metaData = document.getElementsByTagName('meta');
for (var m in metaData) {
if (metaData[m]['httpEquiv'] == 'language') {
return metaData[m]['content'];
}
}
}
$(document).ready(function() {
// Wenn LocalStorage verfügbar ist, geben wir die Möglichkeit die Einstellungen dort zu speichern
tickOptions();
if (localStorage) {
$("#save").removeClass("hidden");
$("#save").click(function() {
localStorage.setItem("pers", true);
$("input[type=checkbox]:checked, input[type=hidden]").each(function(el) {
localStorage.setItem($(this).attr("name"), $(this).val());
});
$("select").each(function(el) {
localStorage.setItem($(this).attr("name"), $(this).val());
});
document.location.href = $("#save").attr("data-href");
});
}
$(".checker").click(function() {
var selector = "." + $(this).attr("data-type");
if ($(selector + " input:checked").length) {
$(selector + " input").prop("checked", false);
} else {
$(selector + " input").prop("checked", true);
}
});
$("#unten").click(function() {
$("#settings-form").append("<input type=\"hidden\" name=\"usage\" value=\"once\">");
switch (getLanguage()) {
case "de":
alert("Auf der folgenden Startseite sind Ihre Einstellungen nun einmalig gespeichert. Nach Ihrer ersten Suche sind diese wieder verloren. Wenn Sie diese speichern möchten, können Sie sich allerdings ein Lesezeichen für die generierte Startseite einrichten.");
break;
case "en":
alert("On the following startpage your settings are saved one-time. They will be lost after your first search. Though if you want to save them, you can create a bookmark for the generated startpage.");
break;
case "es":
// alert(""); TODO
break;
}
});
$("#plugin").click(function() {
$("form").attr('action', $("#save").attr("data-href") + '#plugin-modal');
switch (getLanguage()) {
case "de":
alert("Ihr Browserplugin mit den persönlichen Sucheinstellungen wurde generiert. Folgen Sie bitte der Anleitung auf der folgenden Seite um es zu installieren. Beachten Sie: Zuvor sollten Sie ein eventuell bereits installiertes MetaGer-Plugin entfernen.");
break;
case "en":
alert("Your browser plugin with personal settings was generated. Please follow the instructions on the following page to install it. Notice that beforehand you might have to delete a former MetaGer plugin.");
break;
case "es":
// alert(""); TODO
break;
}
});
$("#settings-focus").val("angepasst");
});
function tickOptions() {
if (localStorage && localStorage.getItem("pers")) {
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("param_")) {
if ($("input[name=" + key + "]").length) {
$("input[name=" + key + "]").attr("checked", "");
} else {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
}
}
} else {
$("div.web input").attr("checked", true);
}
}
function getLanguage() {
var metaData = document.getElementsByTagName('meta');
for (var m in metaData) {
if (metaData[m]["httpEquiv"] == "language") {
return metaData[m]["content"];
}
}
}
\ No newline at end of file
function copyCode () {
$('#codesnippet').select();
try {
var successful = document.execCommand('copy');
if (successful) {
$('#copyButton').removeClass('btn-default');
$('#copyButton').addClass('btn-success');
} else {
$('#copyButton').removeClass('btn-default');
$('#copyButton').addClass('btn-danger');
}
} catch (err) {
$('#copyButton').removeClass('btn-default');
$('#copyButton').addClass('btn-danger');
}
}
window.onload = function () {
$('#copyButton').bind('click', copyCode);
};
function copyCode() {
$("#codesnippet").select();
try {
var successful = document.execCommand('copy');
if (successful) {
$('#copyButton').removeClass('btn-default');
$('#copyButton').addClass('btn-success');
} else {
$('#copyButton').removeClass('btn-default');
$('#copyButton').addClass('btn-danger');
}
} catch (err) {
$('#copyButton').removeClass('btn-default');
$('#copyButton').addClass('btn-danger');
}
}
window.onload = function() {
$('#copyButton').bind('click', copyCode);
};
\ No newline at end of file
{
"js/editLanguage.js": "js/editLanguage-7a1cbfb2ba.js",
"js/kontakt.js": "js/kontakt-de49d68db3.js",
"js/scriptResultPage.js": "js/scriptResultPage-f8cfabc6d9.js",
"js/scriptStartPage.js": "js/scriptStartPage-d043248863.js",
"js/settings.js": "js/settings-6ff0eab621.js",
"js/widgets.js": "js/widgets-866379dd63.js"
"js/editLanguage.js": "js/editLanguage-70b5475eac.js",
"js/kontakt.js": "js/kontakt-04d1236ae0.js",
"js/scriptResultPage.js": "js/scriptResultPage-bfb8a4036c.js",
"js/scriptStartPage.js": "js/scriptStartPage-11a18cf6ce.js",
"js/settings.js": "js/settings-079df50ae4.js",
"js/widgets.js": "js/widgets-783b8fadc2.js"
}
\ No newline at end of file
......@@ -7526,6 +7526,18 @@ a#donation:hover {
#spruch > p + p {
margin-top: 4px;
}
.saver-options {
display: -webkit-box;
display: flex;
padding-bottom: 15px;
}
.saver-options > input {
min-width: 35%;
max-width: 80%;
}
.ui-effects-transfer {
border: 1px dotted black;
}
.result {
margin-bottom: 10px;
width: 100%;
......@@ -7538,6 +7550,17 @@ a#donation:hover {
.result > .resultInformation {
border-radius: 5px;
}
.result > .resultInformation > .save {
position: absolute;
top: 0;
right: 10px;
cursor: pointer;
}
.result > .remover {
cursor: pointer;
text-align: right;
color: #777;
}
.result .title {
color: black;
text-decoration: none;
......
This diff is collapsed.
$(document).ready(function() {
$(".hint").tooltip();
$(".language-text-area").each(function() {
auto_grow(this);
});
$(".language-text-area").keyup(function() {
auto_grow(this);
});
$(document).ready(function () {
$('.hint').tooltip();
$('.language-text-area').each(function () {
auto_grow(this);
});
$('.language-text-area').keyup(function () {
auto_grow(this);
});
});
function auto_grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight + 10) + "px";
}
\ No newline at end of file
function auto_grow (element) {
element.style.height = '5px';
element.style.height = (element.scrollHeight + 10) + 'px';
}