diff --git a/.env b/.env index 1034f2d82..832d947ee 100644 --- a/.env +++ b/.env @@ -4,7 +4,7 @@ APP_KEY=SomeRandomString DB_TYPE=mysql DB_HOST=localhost DB_PORT= -DB_DATABASE=faveo +DB_DATABASE=faveo-dev DB_USERNAME=root DB_PASSWORD= MAIL_DRIVER=smtp diff --git a/README.md b/README.md index b6b65ba5c..cba2aadbd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -
Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 202e877e9..71bc33099 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -9,6 +9,8 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
+ public $phpmailer;
+
/**
* A list of the exception types that should not be reported.
*
@@ -18,18 +20,6 @@ class Handler extends ExceptionHandler
'Symfony\Component\HttpKernel\Exception\HttpException',
];
- /**
- * Create a new controller instance.
- * constructor to check
- * 1. php mailer.
- *
- * @return void
- */
- // public function __construct(PhpMailController $PhpMailController)
- // {
- // $this->PhpMailController = $PhpMailController;
- // }
-
/**
* Report or log an exception.
*
@@ -54,30 +44,34 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $e)
{
- // $phpmail = new PhpMailController;
-// if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
-// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
-// } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
-// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
-// }
-// // This is to check if the debug is true or false
-// if (config('app.debug') == false) {
-// // checking if the error is actually an error page or if its an system error page
-// if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
-// return response()->view('errors.404', []);
-// } else {
-// // checking if the application is installed
-// if (\Config::get('database.install') == 1) {
-// // checking if the error log send to Ladybirdweb is enabled or not
-// if (\Config::get('app.ErrorLog') == '1') {
-// $this->phpmail->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]);
-// }
-// }
-//
-// return response()->view('errors.500', []);
-// }
-// }
-// // returns non oops error message
+ //dd($e);
+ $phpmail = new PhpMailController();
+ $this->PhpMailController = $phpmail;
+ if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
+ return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
+ } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
+ return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
+ }
+ // This is to check if the debug is true or false
+ if (config('app.debug') == false) {
+ // checking if the error is actually an error page or if its an system error page
+ if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
+ return response()->view('errors.404', []);
+ } else {
+ // checking if the application is installed
+ if (\Config::get('database.install') == 1) {
+ // checking if the error log send to Ladybirdweb is enabled or not
+ if (\Config::get('app.ErrorLog') == '1') {
+ try {
+ $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['system_error' => "
Message:".$e->getMessage().'']); + } catch (Exception $exx) { + } + } + } + return response()->view('errors.500', []); + } + } + // returns non oops error message return parent::render($request, $e); // checking if the error is related to http error i.e. page not found if ($this->isHttpException($e)) { diff --git a/app/Http/Controllers/Admin/helpdesk/AgentController.php b/app/Http/Controllers/Admin/helpdesk/AgentController.php index eb16521bf..202e83ecd 100644 --- a/app/Http/Controllers/Admin/helpdesk/AgentController.php +++ b/app/Http/Controllers/Admin/helpdesk/AgentController.php @@ -107,7 +107,8 @@ class AgentController extends Controller // fixing the user role to agent $user->fill($request->input())->save(); // generate password and has immediately to store - $user->password = Hash::make($this->generateRandomString()); + $password = $this->generateRandomString(); + $user->password = Hash::make($password); // fetching all the team details checked for this user $requests = $request->input('team_id'); // get user id of the inserted user detail @@ -127,7 +128,7 @@ class AgentController extends Controller $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); } catch (Exception $e) { // returns if try fails - return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again'); + return redirect('agents')->with('fails', 'Some error occurred while sending mail to the agent. Please check email settings and try again'); } // returns for the success case return redirect('agents')->with('success', 'Agent Created sucessfully'); diff --git a/app/Http/Controllers/Admin/helpdesk/EmailsController.php b/app/Http/Controllers/Admin/helpdesk/EmailsController.php index c639b5388..c68bd7356 100644 --- a/app/Http/Controllers/Admin/helpdesk/EmailsController.php +++ b/app/Http/Controllers/Admin/helpdesk/EmailsController.php @@ -19,8 +19,6 @@ use Crypt; use Exception; use Illuminate\Http\Request; -//use PhpImap\Mailbox as ImapMailbox; - /** * ====================================== * EmailsController. @@ -120,9 +118,14 @@ class EmailsController extends Controller return $return_data; } + if ($request->validate == 'on') { + $validate = '/validate-cert'; + } else { + $validate = '/novalidate-cert'; + } if ($request->fetching_status == 'on') { - $imap_check = $this->getImapStream($request); - if ($imap_check == 0) { + $imap_check = $this->getImapStream($request, $validate); + if ($imap_check[0] == 0) { return 'Incoming email connection failed'; } $need_to_check_imap = 1; @@ -143,17 +146,17 @@ class EmailsController extends Controller if ($need_to_check_imap == 1 && $need_to_check_smtp == 1) { if ($imap_check != 0 && $smtp_check != 0) { - $this->store($request); + $this->store($request, $imap_check[1]); $return = 1; } } elseif ($need_to_check_imap == 1 && $need_to_check_smtp == 0) { if ($imap_check != 0 && $smtp_check == 0) { - $this->store($request); + $this->store($request, $imap_check[1]); $return = 1; } } elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 1) { if ($imap_check == 0 && $smtp_check != 0) { - $this->store($request); + $this->store($request, null); $return = 1; } } elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 0) { @@ -174,14 +177,14 @@ class EmailsController extends Controller * * @return type Redirect */ - public function store($request) + public function store($request, $imap_check) { // dd($request); $email = new Emails(); try { // getConnection($request->input('email_name'), $request->input('email_address'), $request->input('email_address')) // saving all the fields to the database - if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'sending_status', 'auto_response'))->save() == true) { + if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'fetching_encryption', 'sending_status', 'auto_response'))->save() == true) { if ($request->fetching_status == 'on') { $email->fetching_status = 1; } else { @@ -197,7 +200,12 @@ class EmailsController extends Controller } else { $email->auto_response = 0; } - // fetching department value + if ($imap_check !== null) { + $email->fetching_encryption = $imap_check; + } else { + $email->fetching_encryption = $request->fetching_encryption; + } + // fetching department value $email->department = $this->departmentValue($request->input('department')); // fetching priority value $email->priority = $this->priorityValue($request->input('priority')); @@ -289,8 +297,13 @@ class EmailsController extends Controller return $return_data; } // return $request; + if ($request->validate == 'on') { + $validate = '/validate-cert'; + } else { + $validate = '/novalidate-cert'; + } if ($request->fetching_status == 'on') { - $imap_check = $this->getImapStream($request); + $imap_check = $this->getImapStream($request, $validate); if ($imap_check == 0) { return 'Incoming email connection failed'; } @@ -425,7 +438,7 @@ class EmailsController extends Controller * * @return type int */ - public function getImapStream($request) + public function getImapStream($request, $validate) { $fetching_status = $request->input('fetching_status'); $username = $request->input('email_address'); @@ -433,13 +446,20 @@ class EmailsController extends Controller $protocol_id = $request->input('mailbox_protocol'); $fetching_protocol = '/'.$request->input('fetching_protocol'); $fetching_encryption = '/'.$request->input('fetching_encryption'); - if ($fetching_encryption == 'none') { - $fetching_encryption = 'novalidate-cert'; + if ($fetching_encryption == '/none') { + $fetching_encryption2 = '/novalidate-cert'; + $mailbox_protocol = $fetching_encryption2; + $host = $request->input('fetching_host'); + $port = $request->input('fetching_port'); + $mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX'; + } else { + $mailbox_protocol = $fetching_protocol.$fetching_encryption; + $host = $request->input('fetching_host'); + $port = $request->input('fetching_port'); + $mailbox = '{'.$host.':'.$port.$mailbox_protocol.$validate.'}INBOX'; + $mailbox_protocol = $fetching_encryption.$validate; } - $mailbox_protocol = $fetching_protocol.$fetching_encryption; - $host = $request->input('fetching_host'); - $port = $request->input('fetching_port'); - $mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX'; + try { $imap_stream = imap_open($mailbox, $username, $password); } catch (\Exception $ex) { @@ -447,9 +467,9 @@ class EmailsController extends Controller } $imap_stream = imap_open($mailbox, $username, $password); if ($imap_stream) { - $return = 1; + $return = [0 => 1, 1 => $mailbox_protocol]; } else { - $return = 0; + $return = [0 => 0]; } return $return; diff --git a/app/Http/Controllers/Admin/helpdesk/GroupController.php b/app/Http/Controllers/Admin/helpdesk/GroupController.php index 9e8392cc7..a89bc1cfb 100644 --- a/app/Http/Controllers/Admin/helpdesk/GroupController.php +++ b/app/Http/Controllers/Admin/helpdesk/GroupController.php @@ -139,9 +139,6 @@ class GroupController extends Controller //Updating can_assign_ticket field $assignTicket = $request->Input('can_assign_ticket'); $var->can_assign_ticket = $assignTicket; - //Updating can_trasfer_ticket field - $trasferTicket = $request->Input('can_trasfer_ticket'); - $var->can_trasfer_ticket = $trasferTicket; //Updating can_delete_ticket field $deleteTicket = $request->Input('can_delete_ticket'); $var->can_delete_ticket = $deleteTicket; diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController.php b/app/Http/Controllers/Admin/helpdesk/SettingsController.php index 33ccf9136..8402b6c4b 100644 --- a/app/Http/Controllers/Admin/helpdesk/SettingsController.php +++ b/app/Http/Controllers/Admin/helpdesk/SettingsController.php @@ -27,9 +27,11 @@ use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Timezones; // classes +use DB; use Exception; use Illuminate\Http\Request; use Input; +use Lang; /** * SettingsController. @@ -76,7 +78,7 @@ class SettingsController extends Controller /* Direct to Company Settings Page */ return view('themes.default1.admin.helpdesk.settings.company', compact('companys')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -110,10 +112,31 @@ class SettingsController extends Controller return redirect('getcompany')->with('success', 'Company Updated Successfully'); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getcompany')->with('fails', 'Company can not Updated'.'
Code:'.$e->getCode().'
File:'.$e->getFile().'
Line:'.$e->getLine().'