Bugfix and language updates

Fixed links and language translations in installert.
Fixed outgoing mail issue.
This commit is contained in:
Manish Verma
2018-08-13 18:39:36 +05:30
parent 3a52d6f24f
commit 2f6ce43fe1
7 changed files with 101 additions and 57 deletions

View File

@@ -48,6 +48,7 @@ class Handler extends ExceptionHandler
*/
public function report(Exception $e)
{
dd($e);
Bugsnag::setBeforeNotifyFunction(function ($error) { //set bugsnag
return false;
});

View File

@@ -90,7 +90,7 @@ class LanguageController extends Controller
->addColumn('language', function ($model) {
$img_src = 'lb-faveo/flags/'.$model.'.png';
if ($model == Config::get('app.fallback_locale')) {
return '<img src="'.asset($img_src).'"/>&nbsp;'.Config::get('languages.'.$model)[0].' ('.Lang::get('lang.default').')';
return '<img src="'.asset($img_src).'"/>&nbsp;'.Config::get('languages.'.$model)[0].' ('.Lang::get('lang.default-fallback').')';
} else {
return '<img src="'.asset($img_src).'"/>&nbsp;'.Config::get('languages.'.$model)[0];
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Common;
use Exception;
class CommonMailer
{
public function setSmtpDriver($config)
{
try {
if (!$config) {
return false;
}
$https = [];
$https['ssl']['verify_peer'] = FALSE;
$https['ssl']['verify_peer_name'] = FALSE;
$transport = new \Swift_SmtpTransport($config['host'], $config['port'], $config['security']);
$transport->setUsername($config['username']);
$transport->setPassword($config['password']);
$transport->setStreamOptions($https);
$set = new \Swift_Mailer($transport);
// Set the mailer
\Mail::setSwiftMailer($set);
return true;
} catch (Exception $e) {
loging($e->getMessage());
return $e->getMessage();
}
}
public function setMailGunDriver($config)
{
if (!$config) {
return false;
}
return true;
}
}

View File

@@ -16,6 +16,15 @@ use Mail;
class PhpMailController extends Controller
{
/**
*@var variable to instantiate common mailer class
*/
public function __construct()
{
$this->commonMailer = new CommonMailer;
}
public function fetch_smtp_details($id)
{
$emails = Emails::where('id', '=', $id)->first();
@@ -161,45 +170,42 @@ class PhpMailController extends Controller
$content = $messagebody;
}
}
$send = $this->laravelMail($recipants, $recipantname, $subject, $content, $cc, $attachment);
$send = $this->laravelMail($recipants, $recipantname, $subject, $content, $from_address, $cc, $attachment);
return $send;
}
public function setMailConfig($from_address)
public function setMailConfig($mail)
{
$username = $from_address->email_address;
$fromname = $from_address->email_name;
$password = $from_address->password;
$smtpsecure = $from_address->sending_encryption;
$host = $from_address->sending_host;
$port = $from_address->sending_port;
$protocol = $from_address->sending_protocol;
$this->setServices($from_address->id, $protocol);
if ($protocol == 'mail') {
$username = '';
$fromname = '';
$host = '';
$smtpsecure = '';
$port = '';
}
$configs = [
'username' => $username,
'from' => ['address' => $username, 'name' => $fromname],
'password' => $password,
'encryption' => $smtpsecure,
'host' => $host,
'port' => $port,
'driver' => $protocol,
];
foreach ($configs as $key => $config) {
if (is_array($config)) {
foreach ($config as $from) {
\Config::set('mail.'.$key, $config);
switch ($mail->sending_protocol) {
case 'smtp':
$config = ['host' => $mail->sending_host,
'port' => $mail->sending_port,
'security' => $mail->sending_encryption,
'username' => $mail->email_address,
'password' => $mail->password,
];
if (!$this->commonMailer->setSmtpDriver($config)) {
\Log::info('Invaid configuration :- '.$config);
return 'invalid mail configuration';
}
} else {
\Config::set('mail.'.$key, $config);
}
break;
case 'send_mail':
$config = [
'host' => \Config::get('mail.host'),
'port' => \Config::get('mail.port'),
'security' => \Config::get('mail.encryption'),
'username' => \Config::get('mail.username'),
'password' => \Config::get('mail.password'),
];
$this->commonMailer->setSmtpDriver($config);
break;
case 'mailgun':
$this->commonMailer->setMailGunDriver(null);
break;
default:
return 'Mail driver not supported';
}
}
@@ -223,14 +229,14 @@ class PhpMailController extends Controller
return $value;
}
public function laravelMail($to, $toname, $subject, $data, $cc, $attach)
public function laravelMail($to, $toname, $subject, $data, $from_address, $cc, $attach)
{
//dd($to, $toname, $subject, $data, $cc, $attach);
//dd(\Config::get('mail'));
//dd($attach);
$mail = Mail::send('emails.mail', ['data' => $data], function ($m) use ($to, $subject, $toname, $cc, $attach) {
$mail = Mail::send('emails.mail', ['data' => $data], function ($m) use ($to, $subject, $toname, $cc, $attach, $from_address) {
$m->to($to, $toname)->subject($subject);
$m->from($from_address->email_address, $from_address->email_name);
if ($cc != null) {
foreach ($cc as $collaborator) {
//mail to collaborators

View File

@@ -1,18 +0,0 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=SomeRandomString
DB_TYPE=
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_INSTALL=%0%
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

View File

@@ -1592,4 +1592,20 @@ return [
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
//updated 15-5-2017
'session-expired' => 'Session expired or invalid, please try again.',
//update since v1.10
'your_helpdesk_is_ready' => 'Your Helpdesk is Ready!',
'all_right_sparky_you_have_made_it' => 'All right, sparky! Youve made it through the installation.',
'next_step' => 'Next Step',
'login_to_faveo' => 'Login to Faveo',
'learn_more' => 'Learn More',
'video_walk_through' => 'Video walk through',
'email_support' => 'Email Support',
'not-answered' => 'Not answered',
'default-fallback' => 'Fallback language',
'system-language' => 'System\'s default language',
'set_as_sys_lang' => 'Make default',
'system-outgoing-incoming-mail-not-configured' => 'You have not configured system mail. Faveo can\'t fetch tickets from mail or send mail to users without it.',
'confihure-the-mail-now' => 'Click here to configure the mail.',
'system-mail-not-configured-agent-message' => 'System incoming and outgoing email settings are not configured. Please contct your system\'s admin and report the problem.',
];

View File

@@ -56,7 +56,7 @@ active
<ul>
<li class="video-walkthrough"><a target="_blank" href="https://www.youtube.com/channel/UC-eqh-h241b1janp6sU7Iiw">{!! Lang::get('lang.video_walk_through') !!}</a>
</li>
<li class="sidekick"><a target="_blank" href="http://www.ladybirdweb.com/support/knowledgebase">{!! Lang::get('lang.knowledge_base') !!}</a>
<li class="sidekick"><a target="_blank" href="https://www.support.faveohelpdesk.com/knowledgebase">{!! Lang::get('lang.knowledge_base') !!}</a>
</li>
<li class="newsletter"><a href="mailto:support@ladybirdweb.com">{!! Lang::get('lang.email_support') !!}</a>
@@ -71,5 +71,4 @@ active
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="{{asset("lb-faveo/js/index.js")}}"></script>
@stop