Commit 0b60987a authored by Karl's avatar Karl

Merge remote-tracking branch 'origin/development' into 110-deutsche-seite-hilfe-faq-uberarbeiten

parents 598a5142 378af725
......@@ -2,7 +2,7 @@ update(144.76.113.134):
tags:
- 144.76.113.134
only:
- master
- master@open-source/MetaGer
before_script:
# Abhängigkeiten überprüfen
- which composer
......@@ -39,7 +39,7 @@ update(metager2):
tags:
- metager2
only:
- master
- master@open-source/MetaGer
before_script:
# Abhängigkeiten überprüfen
- which composer
......@@ -76,7 +76,7 @@ update(metager3.de):
tags:
- metager3
only:
- development
- development@open-source/MetaGer
before_script:
# Abhängigkeiten überprüfen
- which composer
......
......@@ -26,4 +26,22 @@ class LogController extends Controller
return '';
}
function pluginClose()
{
$redis = Redis::connection('redisLogs');
if( $redis )
{
$redis->incr('logs.plugin.close');
}
}
function pluginInstall()
{
$redis = Redis::connection('redisLogs');
if( $redis )
{
$redis->incr('logs.plugin.install');
}
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use LaravelLocalization;
use Mail;
class MailController extends Controller
......@@ -14,56 +15,56 @@ class MailController extends Controller
* @param int $id
* @return Response
*/
public function contactMail(Request $request){
public function contactMail(Request $request)
{
# Nachricht, die wir an den Nutzer weiterleiten:
$messageType = ""; # [success|error]
$messageType = ""; # [success|error]
$returnMessage = '';
$replyTo = $request->input('email', 'noreply@metager.de');
if($replyTo === ""){
$replyTo = $request->input('email', 'noreply@metager.de');
if ($replyTo === "") {
$replyTo = "noreply@metager.de";
}else{
} else {
$replyTo = $request->input('email');
}
if(!$request->has('message')){
$messageType = "error";
if (!$request->has('message')) {
$messageType = "error";
$returnMessage = "Tut uns leid, aber leider haben wir mit Ihrer Kontaktanfrage keine Daten erhalten. Die Email wurde nicht versand";
}else{
} else {
# Wir versenden die Mail des Benutzers an uns:
$message = $request->input('message');
$subject = "[Ticket " . date("Y") . date("d") . date("m") . date("H") . date("i") . date("s") . "] MetaGer - Kontaktanfrage";
if( Mail::send(['text' => 'kontakt.mail'], ['messageText'=>$message], function($message) use($replyTo, $subject){
if (Mail::send(['text' => 'kontakt.mail'], ['messageText' => $message], function ($message) use ($replyTo, $subject) {
$message->to("office@suma-ev.de", $name = null);
$message->from($replyTo, $name = null);
$message->replyTo($replyTo, $name = null);
$message->subject($subject);
}) ){
})) {
# Mail erfolgreich gesendet
$messageType = "success";
$messageType = "success";
$returnMessage = 'Ihre Email wurde uns erfolgreich zugestellt. Vielen Dank dafür! Wir werden diese schnellstmöglich bearbeiten und uns dann ggf. wieder bei Ihnen melden.';
}else{
} else {
# Fehler beim senden der Email
$messageType = "error";
$messageType = "error";
$returnMessage = 'Beim Senden Ihrer Email ist ein Fehler aufgetreten. Bitte schicken Sie eine Email an: office@suma-ev.de, damit wir uns darum kümmern können.';
}
$messageType = "success";
}
return view('kontakt.kontakt')
->with('title', 'Kontakt')
->with('css', 'kontakt.css')
->with('js', ['openpgp.min.js','kontakt.js'])
->with( $messageType, $returnMessage );
->with('title', 'Kontakt')
->with('css', 'kontakt.css')
->with('js', ['openpgp.min.js', 'kontakt.js'])
->with($messageType, $returnMessage);
}
public function donation(Request $request)
{
# Der enthaltene String wird dem Benutzer nach der Spende ausgegeben
$messageToUser = "";
$messageType = ""; # [success|error]
$messageType = ""; # [success|error]
# Folgende Felder werden vom Spendenformular als Input übergeben:
# Name
......@@ -72,10 +73,10 @@ class MailController extends Controller
# Kontonummer ( IBAN )
# Bankleitzahl ( BIC )
# Nachricht
if(!$request->has('Kontonummer') || !$request->has('Bankleitzahl') || !$request->has('Nachricht')){
if (!$request->has('Kontonummer') || !$request->has('Bankleitzahl') || !$request->has('Nachricht')) {
$messageToUser = "Sie haben eins der folgenden Felder nicht ausgefüllt: IBAN, BIC, Nachricht. Bitte korrigieren Sie Ihre Eingabe und versuchen es erneut.\n";
$messageType = "error";
}else{
$messageType = "error";
} else {
$message = "\r\nName: " . $request->input('Name', 'Keine Angabe');
$message .= "\r\nTelefon: " . $request->input('Telefon', 'Keine Angabe');
$message .= "\r\nKontonummer: " . $request->input('Kontonummer');
......@@ -87,29 +88,35 @@ class MailController extends Controller
$messageToUser .= "Die eingegebene Email-Addresse ($replyTo) scheint nicht korrekt zu sein.";
}
try{
if(Mail::send(['text' => 'kontakt.mail'], ['messageText'=>$message], function($message) use($replyTo){
try {
if (Mail::send(['text' => 'kontakt.mail'], ['messageText' => $message], function ($message) use ($replyTo) {
$message->to("office@suma-ev.de", $name = null);
$message->from($replyTo, $name = null);
$message->replyTo($replyTo, $name = null);
$message->subject("MetaGer - Spende");
})) {
$messageType = "success";
$messageToUser = "Wir haben Ihre Spendenbenachrichtigung dankend erhalten. Eine persönliche Nachricht erhalten Sie in nächster Zeit, falls sie Ihre Kontaktdaten angegeben haben.";
}else{
$messageType = "error";
$messageType = "success";
$messageToUser = "Herzlichen Dank!! Wir haben Ihre Spendenbenachrichtigung erhalten.";
} else {
$messageType = "error";
$messageToUser = 'Beim Senden Ihrer Spendenbenachrichtigung ist ein Fehler auf unserer Seite aufgetreten. Bitte schicken Sie eine Email an: office@suma-ev.de, damit wir uns darum kümmern können.';
}
} catch( \Swift_TransportException $e ){
$messageType = "error";
} catch (\Swift_TransportException $e) {
$messageType = "error";
$messageToUser = 'Beim Senden Ihrer Spendenbenachrichtigung ist ein Fehler auf unserer Seite aufgetreten. Bitte schicken Sie eine Email an: office@suma-ev.de, damit wir uns darum kümmern können.';
}
}
return view('spende.spende')
if ($messageType === "error") {
return view('spende.danke')
->with('title', 'Kontakt')
->with('css', 'donation.css')
->with($messageType,$messageToUser);
->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')];
$data = base64_encode(serialize($data));
return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route("danke", ['data' => $data])));
}
}
}
\ No newline at end of file
}
......@@ -4,9 +4,6 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
#use App\MetaGer\Forwarder;
#use App\MetaGer\Results;
#use App\MetaGer\Search;
use App;
use App\MetaGer;
......
......@@ -75,9 +75,10 @@ class StartpageController extends Controller
return loadPage($subpage);
}
public function loadPlugin(Request $request, $locale = "de")
public function loadPlugin($params, $locale = "de")
{
$requests = $request->all();
$params = unserialize(base64_decode($params));
$requests = $params;
$params = [];
foreach($requests as $key => $value)
{
......@@ -94,9 +95,9 @@ class StartpageController extends Controller
$params['encoding'] = 'utf8';
if(!isset($params['lang']))
$params['lang'] = 'all';
$params["eingabe"] = "";
array_forget($params, 'eingabe');
array_forget($params, 'out');
array_forget($params, 'page');
$link = action('MetaGerSearch@search', $params);
$response = Response::make(
......
......@@ -9,110 +9,112 @@
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(
[
'prefix' => LaravelLocalization::setLocale()/*,
'middleware' => [ 'localeSessionRedirect', 'localizationRedirect' ]*/
],
function()
{
/** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
*/
Route::get('/', 'StartpageController@loadStartPage');
Route::group(
[
'prefix' => LaravelLocalization::setLocale(), /*,
'middleware' => [ 'localeSessionRedirect', 'localizationRedirect' ]*/
],
function () {
/** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
Route::get('img/piwik.png', 'ImageController@generateImage');
Route::get('/', 'StartpageController@loadStartPage');
Route::get('impressum', function()
{
return view('impressum')
->with('title', trans('titles.impressum'))
->with('css', 'impressum.css')
->with('navbarFocus', 'kontakt');
});
Route::get('img/piwik.png', 'ImageController@generateImage');
Route::get('about', function()
{
return view('about')
->with('title', trans('titles.about'))
->with('css', 'about.css')
->with('navbarFocus', 'kontakt');
});
Route::get('team', function()
{
return view('team.team')
->with('title', trans('titles.team'))
->with('css', 'team.css')
->with('navbarFocus', 'kontakt');
});
Route::get('team/pubkey-wsb', function()
{
return view('team.pubkey-wsb')
->with('title', trans('titles.team'))
->with('navbarFocus', 'kontakt');
});
Route::get('impressum', function () {
return view('impressum')
->with('title', trans('titles.impressum'))
->with('css', 'impressum.css')
->with('navbarFocus', 'kontakt');
});
Route::get('impressum.html', function () {
return redirect(url('impressum'));
});
Route::get('kontakt', function()
{
return view('kontakt.kontakt')
->with('title', trans('titles.kontakt'))
->with('css', 'kontakt.css')
->with('js', ['openpgp.min.js','kontakt.js'])
->with('navbarFocus', 'kontakt');
});
Route::get('about', function () {
return view('about')
->with('title', trans('titles.about'))
->with('css', 'about.css')
->with('navbarFocus', 'kontakt');
});
Route::get('team', function () {
return view('team.team')
->with('title', trans('titles.team'))
->with('css', 'team.css')
->with('navbarFocus', 'kontakt');
});
Route::get('team/pubkey-wsb', function () {
return view('team.pubkey-wsb')
->with('title', trans('titles.team'))
->with('navbarFocus', 'kontakt');
});
Route::post('kontakt', 'MailController@contactMail');
Route::get('kontakt', function () {
return view('kontakt.kontakt')
->with('title', trans('titles.kontakt'))
->with('css', 'kontakt.css')
->with('js', ['openpgp.min.js', 'kontakt.js'])
->with('navbarFocus', 'kontakt');
});
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('css', 'donation.css')
->with('navbarFocus', 'foerdern');
});
Route::post('kontakt', 'MailController@contactMail');
Route::get('beitritt', function ()
{
return view('spende.beitritt')
->with('title', trans('titles.beitritt'))
->with('css', 'beitritt.css')
->with('navbarFocus', 'foerdern');
});
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('css', 'donation.css')
->with('navbarFocus', 'foerdern');
});
Route::get('spende/danke/{data}', ['as' => 'danke', function ($data) {
return view('spende.danke')
->with('title', trans('titles.spende'))
->with('css', ['donation.css', 'danke.css'])
->with('navbarFocus', 'foerdern')
->with('data', unserialize(base64_decode($data)));
}]);
Route::get('partnershops', function () {
return view('spende.partnershops')
->with('title', trans('titles.partnershops'))
->with('navbarFocus', 'foerdern')
->with('css', 'partnershops.css');
});
Route::get('bform1.htm', function()
{
return redirect('beitritt');
});
Route::get('spendenaufruf', function()
{
return view('spende.spendenaufruf')
->with('title', 'Spendenaufruf - MetaGer')
->with('navbarFocus', 'foerdern');
});
Route::get('beitritt', function () {
return view('spende.beitritt')
->with('title', trans('titles.beitritt'))
->with('css', 'beitritt.css')
->with('navbarFocus', 'foerdern');
});
Route::post('spende', 'MailController@donation');
Route::get('bform1.htm', function () {
return redirect('beitritt');
});
Route::get('spendenaufruf', function () {
return view('spende.spendenaufruf')
->with('title', 'Spendenaufruf - MetaGer')
->with('navbarFocus', 'foerdern');
});
Route::post('spende', 'MailController@donation');
Route::get('datenschutz', function()
{
return view('datenschutz')
->with('title', trans('titles.datenschutz'))
->with('css', 'privacy.css')
->with('navbarFocus', 'datenschutz');
});
Route::get('datenschutz', function () {
return view('datenschutz')
->with('title', trans('titles.datenschutz'))
->with('css', 'privacy.css')
->with('navbarFocus', 'datenschutz');
});
Route::get('hilfe', function()
{
return view('hilfe')
->with('title', trans('titles.hilfe'))
->with('css', 'help.css')
Route::get('hilfe', function () {
return view('hilfe')
->with('title', trans('titles.hilfe'))
->with('css', 'help.css')
->with('navbarFocus', 'hilfe');
});
......@@ -122,42 +124,40 @@
->with('title', trans('titles.faq'))
->with('css', 'help.css')
->with('navbarFocus', 'hilfe');
});
});
Route::get('widget', function()
{
Route::get('widget', function () {
return view('widget.widget')
->with('title', trans('titles.widget'))
->with('css', 'widget.css')
->with('navbarFocus', 'dienste');
->with('title', trans('titles.widget'))
->with('css', 'widget.css')
->with('navbarFocus', 'dienste');
});
Route::get('sitesearch', 'SitesearchController@loadPage');
Route::get('websearch', function()
{
Route::get('websearch', function () {
return view('widget.websearch')
->with('title', trans('titles.websearch'))
->with('css', 'websearch.css')
->with('navbarFocus', 'dienste');
});
});
Route::get('admin', 'AdminInterface@index');
Route::get('admin/count', 'AdminInterface@count');
Route::get('admin/check', 'AdminInterface@check');
Route::get('settings', 'StartpageController@loadSettings');
Route::get('settings', 'StartpageController@loadSettings');
Route::get('meta/meta.ger3', 'MetaGerSearch@search');
Route::get('meta/picture', 'Pictureproxy@get');
Route::get('clickstats', 'LogController@clicklog');
Route::get('meta/meta.ger3', 'MetaGerSearch@search');
Route::get('meta/picture', 'Pictureproxy@get');
Route::get('clickstats', 'LogController@clicklog');
Route::get('pluginClose', 'LogController@pluginClose');
Route::get('pluginInstall', 'LogController@pluginInstall');
Route::get('qt', 'MetaGerSearch@quicktips');
Route::get('tips', 'MetaGerSearch@tips');
Route::get('opensearch.xml', 'StartpageController@loadPlugin');
Route::get('owi', function()
{
return redirect('https://metager.de/klassik/en/owi/');
});
});
Route::get('qt', 'MetaGerSearch@quicktips');
Route::get('tips', 'MetaGerSearch@tips');
Route::get('/plugins/{params}/opensearch.xml', 'StartpageController@loadPlugin');
Route::get('owi', function () {
return redirect('https://metager.de/klassik/en/owi/');
});
});
......@@ -3,17 +3,17 @@
namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Http\Request;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Redis;
class Search extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
protected $hash, $host, $port, $name, $getString, $useragent, $fp, $sumaFile;
protected $hash, $host, $port, $name, $getString, $useragent, $fp;
protected $buffer_length = 8192;
/**
......@@ -21,15 +21,14 @@ class Search extends Job implements ShouldQueue
*
* @return void
*/
public function __construct($hash, $host, $port, $name, $getString, $useragent, $sumaFile)
public function __construct($hash, $host, $port, $name, $getString, $useragent)
{
$this->hash = $hash;
$this->host = $host;
$this->port = $port;
$this->name = $name;
$this->hash = $hash;
$this->host = $host;
$this->port = $port;
$this->name = $name;
$this->getString = $getString;
$this->useragent = $useragent;
$this->sumaFile = $sumaFile;
}
/**
......@@ -40,79 +39,66 @@ class Search extends Job implements ShouldQueue
public function handle(Request $request)
{
$this->fp = $this->getFreeSocket();
if($this->fp)
{
if($this->writeRequest())
{
if ($this->fp) {
if ($this->writeRequest()) {
$this->readAnswer();
}
}
}
public function disable($sumaFile, $message)
private function readAnswer()
{
$xml = simplexml_load_file($sumaFile);
$xml->xpath("//sumas/suma[@name='" . $this->name . "']")['0']['disabled'] = date(DATE_RFC822, mktime(date("H")+1,date("i"), date("s"), date("m"), date("d"), date("Y")));
$xml->saveXML($sumaFile);
}
private function readAnswer ()
{
$time = microtime(true);
$time = microtime(true);
$headers = '';
$body = '';
$length = 0;
$body = '';
$length = 0;
if(!$this->fp)
{
if (!$this->fp) {
return;
}