Applied fixes from StyleCI

This commit is contained in:
Sujit Prasad
2016-08-05 09:24:12 -04:00
committed by StyleCI Bot
parent 09bf25b5e2
commit e2390f67d4
53 changed files with 1397 additions and 1105 deletions

View File

@@ -2,13 +2,13 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\Agent\helpdesk\NotificationController; use App\Http\Controllers\Agent\helpdesk\NotificationController;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use Exception; use Exception;
use Illuminate\Console\Command;
class SendReport extends Command { class SendReport extends Command
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
@@ -30,7 +30,8 @@ class SendReport extends Command {
* *
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
$mail = new PhpMailController(); $mail = new PhpMailController();
$report = new NotificationController($mail); $report = new NotificationController($mail);
$this->report = $report; $this->report = $report;
@@ -42,15 +43,15 @@ class SendReport extends Command {
* *
* @return mixed * @return mixed
*/ */
public function handle() { public function handle()
{
try { try {
$this->report->send_notification(); $this->report->send_notification();
\Log::info("Report has send"); \Log::info('Report has send');
$this->info("Report has send"); $this->info('Report has send');
} catch (Exception $ex) { } catch (Exception $ex) {
dd($ex); dd($ex);
$this->error($ex->getMessage()); $this->error($ex->getMessage());
} }
} }
} }

View File

@@ -1,5 +1,7 @@
<?php <?php
namespace App\Exceptions; namespace App\Exceptions;
// controller // controller
use Bugsnag; use Bugsnag;
//use Illuminate\Validation\ValidationException; //use Illuminate\Validation\ValidationException;
@@ -11,6 +13,7 @@ use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Validation\ValidationException; use Illuminate\Foundation\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
/** /**
@@ -27,6 +30,7 @@ class Handler extends ExceptionHandler
ModelNotFoundException::class, ModelNotFoundException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class, \Symfony\Component\HttpKernel\Exception\HttpException::class,
]; ];
/** /**
* Report or log an exception. * Report or log an exception.
* *
@@ -48,8 +52,10 @@ class Handler extends ExceptionHandler
$version = \Config::get('app.version'); $version = \Config::get('app.version');
Bugsnag::setAppVersion($version); Bugsnag::setAppVersion($version);
} }
return parent::report($e); return parent::report($e);
} }
/** /**
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
@@ -71,6 +77,7 @@ class Handler extends ExceptionHandler
return $this->common($request, $e); return $this->common($request, $e);
} }
} }
/** /**
* Function to render 500 error page. * Function to render 500 error page.
* *
@@ -84,9 +91,11 @@ class Handler extends ExceptionHandler
if (config('app.debug') == true) { if (config('app.debug') == true) {
return parent::render($request, $e); return parent::render($request, $e);
} }
return response()->view('errors.500'); return response()->view('errors.500');
//return redirect()->route('error500', []); //return redirect()->route('error500', []);
} }
/** /**
* Function to render 404 error page. * Function to render 404 error page.
* *
@@ -97,21 +106,23 @@ class Handler extends ExceptionHandler
*/ */
public function render404($request, $e) public function render404($request, $e)
{ {
$seg = $request->segments(); $seg = $request->segments();
if (in_array('api', $seg)) { if (in_array('api', $seg)) {
return response()->json(['status' => '404']); return response()->json(['status' => '404']);
} }
if (config('app.debug') == true) { if (config('app.debug') == true) {
if($e->getStatusCode() == '404') { if ($e->getStatusCode() == '404') {
return redirect()->route('error404', []); return redirect()->route('error404', []);
} }
return parent::render($request, $e); return parent::render($request, $e);
} }
return redirect()->route('error404', []); return redirect()->route('error404', []);
} }
/** /**
* Function to render database connection failed * Function to render database connection failed.
* *
* @param type $request * @param type $request
* @param type $e * @param type $e
@@ -127,8 +138,10 @@ class Handler extends ExceptionHandler
if (config('app.debug') == true) { if (config('app.debug') == true) {
return parent::render($request, $e); return parent::render($request, $e);
} }
return redirect()->route('error404', []); return redirect()->route('error404', []);
} }
/** /**
* Common finction to render both types of codes. * Common finction to render both types of codes.
* *
@@ -145,7 +158,7 @@ class Handler extends ExceptionHandler
case $e instanceof NotFoundHttpException: case $e instanceof NotFoundHttpException:
return $this->render404($request, $e); return $this->render404($request, $e);
case $e instanceof PDOException: case $e instanceof PDOException:
if(strpos('1045', $e->getMessage()) == true) { if (strpos('1045', $e->getMessage()) == true) {
return $this->renderDB($request, $e); return $this->renderDB($request, $e);
} else { } else {
return $this->render500($request, $e); return $this->render500($request, $e);
@@ -159,6 +172,7 @@ class Handler extends ExceptionHandler
default: default:
return $this->render500($request, $e); return $this->render500($request, $e);
} }
return parent::render($request, $e); return parent::render($request, $e);
} }
} }

View File

@@ -3,8 +3,8 @@
namespace App\Http\Controllers\Admin\helpdesk; namespace App\Http\Controllers\Admin\helpdesk;
// controller // controller
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Controller;
// request // request
use App\Http\Requests\helpdesk\AgentRequest; use App\Http\Requests\helpdesk\AgentRequest;
use App\Http\Requests\helpdesk\AgentUpdate; use App\Http\Requests\helpdesk\AgentUpdate;
@@ -139,7 +139,7 @@ class AgentController extends Controller
// fetch user credentails to send mail // fetch user credentails to send mail
$name = $user->first_name; $name = $user->first_name;
$email = $user->email; $email = $user->email;
if($request->input('send_email')) { if ($request->input('send_email')) {
try { try {
// send mail on registration // send mail on registration
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);

View File

@@ -29,14 +29,15 @@ use Lang;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class DepartmentController extends Controller { class DepartmentController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
@@ -48,9 +49,11 @@ class DepartmentController extends Controller {
* *
* @return type Response * @return type Response
*/ */
public function index(Department $department) { public function index(Department $department)
{
try { try {
$departments = $department->get(); $departments = $department->get();
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments')); return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -70,7 +73,8 @@ class DepartmentController extends Controller {
* *
* @return type Response * @return type Response
*/ */
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) { public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group)
{
try { try {
$slas = $sla->get(); $slas = $sla->get();
$user = $user->where('role', 'agent2')->get(); $user = $user->where('role', 'agent2')->get();
@@ -93,7 +97,8 @@ class DepartmentController extends Controller {
* *
* @return type Response * @return type Response
*/ */
public function store(Department $department, DepartmentRequest $request) { public function store(Department $department, DepartmentRequest $request)
{
try { try {
$department->fill($request->except('group_id', 'manager', 'sla'))->save(); $department->fill($request->except('group_id', 'manager', 'sla'))->save();
if ($request->sla) { if ($request->sla) {
@@ -116,6 +121,7 @@ class DepartmentController extends Controller {
->where('id', 1) ->where('id', 1)
->update(['department' => $department->id]); ->update(['department' => $department->id]);
} }
return redirect('departments')->with('success', Lang::get('lang.department_created_sucessfully')); return redirect('departments')->with('success', Lang::get('lang.department_created_sucessfully'));
} else { } else {
return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department')); return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department'));
@@ -140,7 +146,8 @@ class DepartmentController extends Controller {
* *
* @return type Response * @return type Response
*/ */
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) { public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group)
{
try { try {
$sys_department = \DB::table('settings_system') $sys_department = \DB::table('settings_system')
->select('department') ->select('department')
@@ -170,7 +177,8 @@ class DepartmentController extends Controller {
* *
* @return type Response * @return type Response
*/ */
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) { public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request)
{
// dd($id); // dd($id);
try { try {
$table = $group_assign_department->where('department_id', $id); $table = $group_assign_department->where('department_id', $id);
@@ -218,9 +226,10 @@ class DepartmentController extends Controller {
* *
* @return type Response * @return type Response
*/ */
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) { public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets)
{
// try { // try {
$system = $system->where('id', '=', '1')->first(); $system = $system->where('id', '=', '1')->first();
if ($system->department == $id) { if ($system->department == $id) {
return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department')); return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department'));
@@ -232,7 +241,7 @@ class DepartmentController extends Controller {
} else { } else {
$text_tickets = 'Ticket'; $text_tickets = 'Ticket';
} }
$ticket = '<li>' . $tickets . ' ' . $text_tickets . Lang::get('lang.have_been_moved_to_default_department') . '</li>'; $ticket = '<li>'.$tickets.' '.$text_tickets.Lang::get('lang.have_been_moved_to_default_department').'</li>';
} else { } else {
$ticket = ''; $ticket = '';
} }
@@ -243,7 +252,7 @@ class DepartmentController extends Controller {
} else { } else {
$text_user = 'User'; $text_user = 'User';
} }
$user = '<li>' . $users . ' ' . $text_user . Lang::get('lang.have_been_moved_to_default_department') . '</li>'; $user = '<li>'.$users.' '.$text_user.Lang::get('lang.have_been_moved_to_default_department').'</li>';
} else { } else {
$user = ''; $user = '';
} }
@@ -254,28 +263,27 @@ class DepartmentController extends Controller {
} else { } else {
$text_emails = 'Email'; $text_emails = 'Email';
} }
$email = '<li>' . $emails . ' System ' . $text_emails . Lang::get('lang.have_been_moved_to_default_department') . ' </li>'; $email = '<li>'.$emails.' System '.$text_emails.Lang::get('lang.have_been_moved_to_default_department').' </li>';
} else { } else {
$email = ''; $email = '';
} }
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']); $helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
if ($helptopic > 0) { if ($helptopic > 0) {
$helptopic = '<li>' . Lang::get('lang.the_associated_helptopic_has_been_deactivated') . '</li>'; $helptopic = '<li>'.Lang::get('lang.the_associated_helptopic_has_been_deactivated').'</li>';
} else { } else {
$helptopic = ''; $helptopic = '';
} }
$message = $ticket . $user . $email . $helptopic; $message = $ticket.$user.$email.$helptopic;
/* Becouse of foreign key we delete group_assign_department first */ /* Becouse of foreign key we delete group_assign_department first */
$group_assign_department = $group_assign_department->where('department_id', $id); $group_assign_department = $group_assign_department->where('department_id', $id);
$group_assign_department->delete(); $group_assign_department->delete();
$departments = $department->whereId($id)->first(); $departments = $department->whereId($id)->first();
/* Check the function is Success or Fail */ /* Check the function is Success or Fail */
if ($departments->delete() == true) { if ($departments->delete() == true) {
return redirect('departments')->with('success', Lang::get('lang.department_deleted_sucessfully') . $message); return redirect('departments')->with('success', Lang::get('lang.department_deleted_sucessfully').$message);
} else { } else {
return redirect('departments')->with('fails', Lang::get('lang.department_can_not_delete')); return redirect('departments')->with('fails', Lang::get('lang.department_can_not_delete'));
} }
} }
} }
} }

View File

@@ -1,5 +1,7 @@
<?php <?php
namespace App\Http\Controllers\Admin\helpdesk; namespace App\Http\Controllers\Admin\helpdesk;
// Controller // Controller
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Model // Model
@@ -12,6 +14,7 @@ use Illuminate\Http\Request;
use Input; use Input;
use Lang; use Lang;
use Redirect; use Redirect;
/** /**
* FormController * FormController
* This controller is used to CRUD Custom Forms. * This controller is used to CRUD Custom Forms.
@@ -22,12 +25,14 @@ class FormController extends Controller
{ {
private $fields; private $fields;
private $forms; private $forms;
public function __construct(Fields $fields, Forms $forms) public function __construct(Fields $fields, Forms $forms)
{ {
$this->fields = $fields; $this->fields = $fields;
$this->forms = $forms; $this->forms = $forms;
$this->middleware('auth'); $this->middleware('auth');
} }
/** /**
* home. * home.
* *
@@ -37,6 +42,7 @@ class FormController extends Controller
{ {
return view('forms.home'); return view('forms.home');
} }
/** /**
* list of forms. * list of forms.
* *
@@ -52,6 +58,7 @@ class FormController extends Controller
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
} }
/** /**
* create a new form. * create a new form.
* *
@@ -65,6 +72,7 @@ class FormController extends Controller
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
} }
/** /**
* Show a new form. * Show a new form.
* *
@@ -80,6 +88,7 @@ class FormController extends Controller
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
} }
/** /**
* Store a new form. * Store a new form.
* *
@@ -115,8 +124,10 @@ class FormController extends Controller
} }
} }
Fields::insert($fields); Fields::insert($fields);
return Redirect::back()->with('success', Lang::get('lang.successfully_created_form')); return Redirect::back()->with('success', Lang::get('lang.successfully_created_form'));
} }
/** /**
* Delete Form. * Delete Form.
* *
@@ -140,6 +151,7 @@ class FormController extends Controller
} }
$forms = $forms->where('id', $id)->first(); $forms = $forms->where('id', $id)->first();
$forms->delete(); $forms->delete();
return redirect()->back()->with('success', Lang::get('lang.form_deleted_successfully')); return redirect()->back()->with('success', Lang::get('lang.form_deleted_successfully'));
} }
} }

View File

@@ -99,11 +99,10 @@ class LanguageController extends Controller
return \Datatable::collection(new Collection($values)) return \Datatable::collection(new Collection($values))
->addColumn('language', function ($model) { ->addColumn('language', function ($model) {
if ($model == Config::get('app.fallback_locale')) { if ($model == Config::get('app.fallback_locale')) {
return Config::get('languages.'.$model).' ('.Lang::get('lang.default').')'; return Config::get('languages.'.$model).' ('.Lang::get('lang.default').')';
} else { } else {
return Config::get('languages.'.$model); return Config::get('languages.'.$model);
} }
}) })
->addColumn('id', function ($model) { ->addColumn('id', function ($model) {
return $model; return $model;
@@ -239,16 +238,17 @@ class LanguageController extends Controller
if ($success) { if ($success) {
//sending back with success message //sending back with success message
Session::flash('success', Lang::get('lang.delete-success')); Session::flash('success', Lang::get('lang.delete-success'));
return Redirect::back(); return Redirect::back();
} else { } else {
//sending back with error message //sending back with error message
Session::flash('fails', Lang::get('lang.lang-doesnot-exist')); Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
return Redirect::back(); return Redirect::back();
} }
} else { } else {
Session::flash('fails', Lang::get('lang.lang-fallback-lang')); Session::flash('fails', Lang::get('lang.lang-fallback-lang'));
return redirect('languages'); return redirect('languages');
} }
} else { } else {
@@ -257,5 +257,4 @@ class LanguageController extends Controller
return redirect('languages'); return redirect('languages');
} }
} }
} }

View File

@@ -19,6 +19,7 @@ use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Notification\UserNotification; use App\Model\helpdesk\Notification\UserNotification;
use App\Model\helpdesk\Ratings\Rating; use App\Model\helpdesk\Ratings\Rating;
use App\Model\helpdesk\Settings\Alert; use App\Model\helpdesk\Settings\Alert;
use App\Model\helpdesk\Settings\CommonSettings;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Settings\Responder; use App\Model\helpdesk\Settings\Responder;
@@ -30,7 +31,6 @@ use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Time_format;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Workflow\WorkflowClose; use App\Model\helpdesk\Workflow\WorkflowClose;
use App\Model\helpdesk\Settings\CommonSettings;
use DateTime; use DateTime;
// classes // classes
use DB; use DB;
@@ -184,7 +184,7 @@ class SettingsController extends Controller
/* Check whether function success or not */ /* Check whether function success or not */
$systems->fill($request->input())->save(); $systems->fill($request->input())->save();
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first(); $rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if($request->enable_rtl != null) { if ($request->enable_rtl != null) {
$rtl->option_value = 1; $rtl->option_value = 1;
} else { } else {
$rtl->option_value = 0; $rtl->option_value = 0;
@@ -192,7 +192,7 @@ class SettingsController extends Controller
$rtl->save(); $rtl->save();
$usts = CommonSettings::where('option_name', '=', 'user_set_ticket_status')->first(); $usts = CommonSettings::where('option_name', '=', 'user_set_ticket_status')->first();
if ($usts->status != $request->user_set_ticket_status){ if ($usts->status != $request->user_set_ticket_status) {
$usts->status = $request->user_set_ticket_status; $usts->status = $request->user_set_ticket_status;
$usts->save(); $usts->save();
} }

View File

@@ -12,8 +12,8 @@ use App\Http\Requests\helpdesk\TemplateUdate;
// models // models
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Email\Template; use App\Model\helpdesk\Email\Template;
use App\Model\helpdesk\Utility\Languages;
use App\Model\helpdesk\Settings\CommonSettings; use App\Model\helpdesk\Settings\CommonSettings;
use App\Model\helpdesk\Utility\Languages;
// classes // classes
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -329,13 +329,13 @@ class TemplateController extends Controller
$mail->AddAddress($address); $mail->AddAddress($address);
$mail->Subject = $request->subject; // subject of the email $mail->Subject = $request->subject; // subject of the email
$body = $request->message; // body of the email $body = $request->message; // body of the email
$mail->CharSet = "utf8"; $mail->CharSet = 'utf8';
// $mail->MsgHTML($body); // $mail->MsgHTML($body);
// $body = $request->message; // $body = $request->message;
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first(); $rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if($rtl->option_value == 1) { if ($rtl->option_value == 1) {
$mail->ContentType = 'text/html'; $mail->ContentType = 'text/html';
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>'; $body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">'.$body.'</body></html>';
} else { } else {
} }
if (!$mail->Send()) { if (!$mail->Send()) {
@@ -364,13 +364,13 @@ class TemplateController extends Controller
$mail->setFrom($email_details->email_address, $email_details->email_name); $mail->setFrom($email_details->email_address, $email_details->email_name);
$mail->addAddress($request->to, ''); // Add a recipient $mail->addAddress($request->to, ''); // Add a recipient
$mail->isHTML(true); // Set email format to HTML $mail->isHTML(true); // Set email format to HTML
$mail->CharSet = "utf8"; $mail->CharSet = 'utf8';
$mail->Subject = $request->subject; $mail->Subject = $request->subject;
$body = $request->message; $body = $request->message;
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first(); $rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if($rtl->option_value == 1) { if ($rtl->option_value == 1) {
$mail->ContentType = 'text/html'; $mail->ContentType = 'text/html';
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>'; $body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">'.$body.'</body></html>';
} else { } else {
} }
$mail->Body = $body; $mail->Body = $body;
@@ -380,6 +380,7 @@ class TemplateController extends Controller
$return = Lang::get('lang.message_has_been_sent'); $return = Lang::get('lang.message_has_been_sent');
} }
} }
return redirect()->back()->with('success', $return); return redirect()->back()->with('success', $return);
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());

View File

@@ -27,15 +27,16 @@ use PhpImap\Mailbox as ImapMailbox;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class MailController extends Controller { class MailController extends Controller
{
/** /**
* constructor * constructor
* Create a new controller instance. * Create a new controller instance.
* *
* @param type TicketController $TicketController * @param type TicketController $TicketController
*/ */
public function __construct(TicketWorkflowController $TicketWorkflowController) { public function __construct(TicketWorkflowController $TicketWorkflowController)
{
$this->middleware('board'); $this->middleware('board');
$this->TicketWorkflowController = $TicketWorkflowController; $this->TicketWorkflowController = $TicketWorkflowController;
} }
@@ -45,7 +46,8 @@ class MailController extends Controller {
* *
* @return type * @return type
*/ */
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) { public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket)
{
// $path_url = $system->first()->url; // $path_url = $system->first()->url;
if ($settings_email->first()->email_fetching == 1) { if ($settings_email->first()->email_fetching == 1) {
if ($settings_email->first()->all_emails == 1) { if ($settings_email->first()->all_emails == 1) {
@@ -80,7 +82,7 @@ class MailController extends Controller {
$protocol = $fetching_encryption2; $protocol = $fetching_encryption2;
} else { } else {
if ($e_mail->fetching_protocol) { if ($e_mail->fetching_protocol) {
$fetching_protocol = '/' . $e_mail->fetching_protocol; $fetching_protocol = '/'.$e_mail->fetching_protocol;
} else { } else {
$fetching_protocol = ''; $fetching_protocol = '';
} }
@@ -89,20 +91,20 @@ class MailController extends Controller {
} else { } else {
$fetching_encryption = ''; $fetching_encryption = '';
} }
$protocol = $fetching_protocol . $fetching_encryption; $protocol = $fetching_protocol.$fetching_encryption;
} }
$imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX'; $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
$password = Crypt::decrypt($e_mail->password); $password = Crypt::decrypt($e_mail->password);
try { try {
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
} catch (\PhpImap\Exception $e) { } catch (\PhpImap\Exception $e) {
echo "Connection error"; echo 'Connection error';
} }
$mails = []; $mails = [];
try { try {
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime('-1 day'))); $mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
} catch (\PhpImap\Exception $e) { } catch (\PhpImap\Exception $e) {
echo "Connection error"; echo 'Connection error';
} }
if (!$mailsIds) { if (!$mailsIds) {
die('Mailbox is empty'); die('Mailbox is empty');
@@ -119,7 +121,7 @@ class MailController extends Controller {
try { try {
$mail = $mailbox->getMail($mailId); $mail = $mailbox->getMail($mailId);
} catch (\PhpImap\Exception $e) { } catch (\PhpImap\Exception $e) {
echo "Connection error"; echo 'Connection error';
} }
if ($settings_email->first()->email_collaborator == 1) { if ($settings_email->first()->email_collaborator == 1) {
$collaborator = $mail->cc; $collaborator = $mail->cc;
@@ -137,11 +139,11 @@ class MailController extends Controller {
if ($body == null) { if ($body == null) {
$attach = $mail->getAttachments(); $attach = $mail->getAttachments();
if (is_array($attach)) { if (is_array($attach)) {
if (key_exists('html-body', $attach)) { if (array_key_exists('html-body', $attach)) {
$path = $attach['html-body']->filePath; $path = $attach['html-body']->filePath;
} }
if ($path == null) { if ($path == null) {
if (key_exists('text-body', $attach)) { if (array_key_exists('text-body', $attach)) {
$path = $attach['text-body']->filePath; $path = $attach['text-body']->filePath;
} }
} }
@@ -151,7 +153,7 @@ class MailController extends Controller {
if ($body) { if ($body) {
$body = self::trimTableTag($body); $body = self::trimTableTag($body);
} else { } else {
$body = ""; $body = '';
} }
} }
} }
@@ -162,7 +164,7 @@ class MailController extends Controller {
$date = $mail->date; $date = $mail->date;
$datetime = $overview[0]->date; $datetime = $overview[0]->date;
$date_time = explode(' ', $datetime); $date_time = explode(' ', $datetime);
$date = $date_time[1] . '-' . $date_time[2] . '-' . $date_time[3] . ' ' . $date_time[4]; $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
$date = date('Y-m-d H:i:s', strtotime($date)); $date = date('Y-m-d H:i:s', strtotime($date));
if (isset($mail->subject)) { if (isset($mail->subject)) {
$subject = $mail->subject; $subject = $mail->subject;
@@ -193,10 +195,10 @@ class MailController extends Controller {
$dir_img_paths = __DIR__; $dir_img_paths = __DIR__;
$dir_img_path = explode('/code', $dir_img_paths); $dir_img_path = explode('/code', $dir_img_paths);
$filepath = explode('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public', $attachment->filePath); $filepath = explode('..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'public', $attachment->filePath);
if ($filepath[1]) { if ($filepath[1]) {
$path = public_path() . $filepath[1]; $path = public_path().$filepath[1];
$filesize = filesize($path); $filesize = filesize($path);
$file_data = file_get_contents($path); $file_data = file_get_contents($path);
@@ -205,7 +207,7 @@ class MailController extends Controller {
$string = str_replace('-', '', $attachment->name); $string = str_replace('-', '', $attachment->name);
$filename = explode('src', $attachment->filePath); $filename = explode('src', $attachment->filePath);
$filename = str_replace('\\', '', $filename); $filename = str_replace('\\', '', $filename);
$body = str_replace('cid:' . $imageid, $filepath[1], $body); $body = str_replace('cid:'.$imageid, $filepath[1], $body);
$pos = strpos($body, $filepath[1]); $pos = strpos($body, $filepath[1]);
if ($pos == false) { if ($pos == false) {
if ($settings_email->first()->attachment == 1) { if ($settings_email->first()->attachment == 1) {
@@ -251,7 +253,8 @@ class MailController extends Controller {
* *
* @return type string * @return type string
*/ */
public function separate_reply($body) { public function separate_reply($body)
{
$body2 = explode('---Reply above this line---', $body); $body2 = explode('---Reply above this line---', $body);
$body3 = $body2[0]; $body3 = $body2[0];
@@ -265,7 +268,8 @@ class MailController extends Controller {
* *
* @return type string * @return type string
*/ */
public function decode_imap_text($str) { public function decode_imap_text($str)
{
$result = ''; $result = '';
$decode_header = imap_mime_header_decode($str); $decode_header = imap_mime_header_decode($str);
foreach ($decode_header as $obj) { foreach ($decode_header as $obj) {
@@ -280,7 +284,8 @@ class MailController extends Controller {
* *
* @return type * @return type
*/ */
public function fetch_attachments() { public function fetch_attachments()
{
$uploads = Upload::all(); $uploads = Upload::all();
foreach ($uploads as $attachment) { foreach ($uploads as $attachment) {
$image = @imagecreatefromstring($attachment->file); $image = @imagecreatefromstring($attachment->file);
@@ -288,8 +293,8 @@ class MailController extends Controller {
imagejpeg($image, null, 80); imagejpeg($image, null, 80);
$data = ob_get_contents(); $data = ob_get_contents();
ob_end_clean(); ob_end_clean();
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>'; $var = '<a href="" target="_blank"><img src="data:image/jpg;base64,'.base64_encode($data).'"/></a>';
echo '<br/><span class="mailbox-attachment-icon has-img">' . $var . '</span>'; echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>';
} }
} }
@@ -300,17 +305,19 @@ class MailController extends Controller {
* *
* @return type file * @return type file
*/ */
public function get_data($id) { public function get_data($id)
{
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get(); $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
header('Content-type: application/' . $attachment->type . ''); header('Content-type: application/'.$attachment->type.'');
header('Content-Disposition: inline; filename=' . $attachment->name . ''); header('Content-Disposition: inline; filename='.$attachment->name.'');
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
echo $attachment->file; echo $attachment->file;
} }
} }
public static function trimTableTag($html) { public static function trimTableTag($html)
{
if (strpos('<table>', $html) != false) { if (strpos('<table>', $html) != false) {
$first_pos = strpos($html, '<table'); $first_pos = strpos($html, '<table');
$fist_string = substr_replace($html, '', 0, $first_pos); $fist_string = substr_replace($html, '', 0, $first_pos);
@@ -326,13 +333,15 @@ class MailController extends Controller {
return $html; return $html;
} }
public static function trim3D($html) { public static function trim3D($html)
{
$body = str_replace('=3D', '', $html); $body = str_replace('=3D', '', $html);
return $body; return $body;
} }
public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>']) { public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>'])
{
$replace = []; $replace = [];
foreach ($tags as $key => $tag) { foreach ($tags as $key => $tag) {
$replace[$key] = htmlspecialchars($tag); $replace[$key] = htmlspecialchars($tag);
@@ -341,5 +350,4 @@ class MailController extends Controller {
return $body; return $body;
} }
} }

View File

@@ -22,16 +22,18 @@ use View;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class NotificationController extends Controller { class NotificationController extends Controller
{
public function __construct(PhpMailController $PhpMailController) { public function __construct(PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
} }
/** /**
* This function is for sending daily report/notification about the system. * This function is for sending daily report/notification about the system.
* */ * */
public function send_notification() { public function send_notification()
{
//fetching email settings //fetching email settings
$email = Email::where('id', '=', '1')->first(); $email = Email::where('id', '=', '1')->first();
// checking if the daily notification is enabled or not // checking if the daily notification is enabled or not
@@ -40,7 +42,6 @@ class NotificationController extends Controller {
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first(); $notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
$date = explode(' ', $notification->created_at); $date = explode(' ', $notification->created_at);
if (date('Y-m-d') == $date[0]) { if (date('Y-m-d') == $date[0]) {
} else { } else {
// creating a daily notification log // creating a daily notification log
Log_notification::create(['log' => 'NOT-1']); Log_notification::create(['log' => 'NOT-1']);
@@ -64,24 +65,25 @@ class NotificationController extends Controller {
* *
* @return mail * @return mail
* */ * */
public function send_notification_to_admin($company) { public function send_notification_to_admin($company)
{
// get all admin users // get all admin users
$users = User::where('role', '=', 'admin')->get(); $users = User::where('role', '=', 'admin')->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to admin // Send notification details to admin
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . ' ' . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
$view = View::make('emails.notifications.admin', ['company' => $company, 'name' => $user_name]); $view = View::make('emails.notifications.admin', ['company' => $company, 'name' => $user_name]);
$contents = $view->render(); $contents = $view->render();
$from = $this->PhpMailController->mailfrom('1', '0'); $from = $this->PhpMailController->mailfrom('1', '0');
$to = [ $to = [
'name' => $user_name, 'name' => $user_name,
'email' => $email 'email' => $email,
]; ];
$message = [ $message = [
'subject' => 'Daily Report', 'subject' => 'Daily Report',
'scenario' => null, 'scenario' => null,
'body' => $contents 'body' => $contents,
]; ];
$this->dispatch((new \App\Jobs\SendEmail($from, $to, $message))->onQueue('emails')); $this->dispatch((new \App\Jobs\SendEmail($from, $to, $message))->onQueue('emails'));
//$this->PhpMailController->sendEmail($from,$to,$message); //$this->PhpMailController->sendEmail($from,$to,$message);
@@ -93,7 +95,8 @@ class NotificationController extends Controller {
* *
* @return mail * @return mail
* */ * */
public function send_notification_to_manager($company) { public function send_notification_to_manager($company)
{
// get all department managers // get all department managers
$depts = Department::all(); $depts = Department::all();
foreach ($depts as $dept) { foreach ($depts as $dept) {
@@ -103,7 +106,7 @@ class NotificationController extends Controller {
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to manager of a department // Send notification details to manager of a department
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . ' ' . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
$view = View::make('emails.notifications.manager', ['company' => $company, 'name' => $user_name]); $view = View::make('emails.notifications.manager', ['company' => $company, 'name' => $user_name]);
$contents = $view->render(); $contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]); $this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
@@ -117,7 +120,8 @@ class NotificationController extends Controller {
* *
* @return mail * @return mail
* */ * */
public function send_notification_to_team_lead($company) { public function send_notification_to_team_lead($company)
{
// get all Team leads // get all Team leads
$teams = Teams::all(); $teams = Teams::all();
foreach ($teams as $team) { foreach ($teams as $team) {
@@ -127,7 +131,7 @@ class NotificationController extends Controller {
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to team lead // Send notification details to team lead
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . ' ' . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id]); $view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id]);
$contents = $view->render(); $contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]); $this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
@@ -141,13 +145,14 @@ class NotificationController extends Controller {
* *
* @return mail * @return mail
* */ * */
public function send_notification_to_agent($company) { public function send_notification_to_agent($company)
{
// get all agents users // get all agents users
$users = User::where('role', '=', 'agent')->get(); $users = User::where('role', '=', 'agent')->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to all the agents // Send notification details to all the agents
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . ' ' . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
$view = View::make('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => $user->id]); $view = View::make('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => $user->id]);
$contents = $view->render(); $contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]); $this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
@@ -159,7 +164,8 @@ class NotificationController extends Controller {
* *
* @return type variable * @return type variable
*/ */
public function company() { public function company()
{
// fetching comapny model // fetching comapny model
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
// fetching company name // fetching company name
@@ -171,5 +177,4 @@ class NotificationController extends Controller {
return $company; return $company;
} }
} }

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Agent\helpdesk; namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
// models // models
@@ -51,8 +50,10 @@ class Ticket2Controller extends Controller
} }
/** /**
* this function returns the list of open tickets of a particular department * this function returns the list of open tickets of a particular department.
*
* @param type $id * @param type $id
*
* @return type * @return type
*/ */
public function getOpenTickets($id) public function getOpenTickets($id)
@@ -63,6 +64,7 @@ class Ticket2Controller extends Controller
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
} }
return Ttable::getTable($tickets); return Ttable::getTable($tickets);
} }
@@ -84,10 +86,12 @@ class Ticket2Controller extends Controller
return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id')); return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id'));
} }
} }
/** /**
* this function returns the list of close tickets of a particular department * this function returns the list of close tickets of a particular department.
*
* @param type $id * @param type $id
*
* @return type * @return type
*/ */
public function getCloseTickets($id) public function getCloseTickets($id)
@@ -98,12 +102,15 @@ class Ticket2Controller extends Controller
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', '2')->where('status', '=', '3')->where('dept_id', '=', $dept->id)->get(); $tickets = Tickets::where('status', '=', '2')->where('status', '=', '3')->where('dept_id', '=', $dept->id)->get();
} }
return Ttable::getTable($tickets); return Ttable::getTable($tickets);
} }
/** /**
* this function returns the list of close tickets of a particular department * this function returns the list of close tickets of a particular department.
*
* @param type $id * @param type $id
*
* @return type * @return type
*/ */
public function deptinprogress($id) public function deptinprogress($id)
@@ -136,5 +143,4 @@ class Ticket2Controller extends Controller
return Ttable::getTable($tickets); return Ttable::getTable($tickets);
} }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -350,6 +350,7 @@ class TicketWorkflowController extends Controller
$ticket_settings_details = $this->changeStatus($workflow_action, $ticket_settings_details); $ticket_settings_details = $this->changeStatus($workflow_action, $ticket_settings_details);
} }
} }
return $ticket_settings_details; return $ticket_settings_details;
} }

View File

@@ -3,8 +3,8 @@
namespace App\Http\Controllers\Agent\helpdesk; namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Controller;
// requests // requests
/* Include Sys_user Model */ /* Include Sys_user Model */
use App\Http\Requests\helpdesk\ProfilePassword; use App\Http\Requests\helpdesk\ProfilePassword;
@@ -79,7 +79,7 @@ class UserController extends Controller
public function user_list() public function user_list()
{ {
// displaying list of users with chumper datatables // displaying list of users with chumper datatables
return \Datatable::collection(User::where('role',"=","user")->get()) return \Datatable::collection(User::where('role', '=', 'user')->get())
/* searchable column username and email */ /* searchable column username and email */
->searchColumns('user_name', 'email', 'phone') ->searchColumns('user_name', 'email', 'phone')
/* order column username and email */ /* order column username and email */
@@ -207,7 +207,7 @@ class UserController extends Controller
// fetch user credentails to send mail // fetch user credentails to send mail
$name = $user->first_name; $name = $user->first_name;
$email = $user->email; $email = $user->email;
if($request->input('send_email')) { if ($request->input('send_email')) {
try { try {
// send mail on registration // send mail on registration
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
@@ -283,7 +283,7 @@ class UserController extends Controller
*/ */
public function update($id, Sys_userUpdate $request) public function update($id, Sys_userUpdate $request)
{ {
// dd($request); // dd($request);
$user = new User(); $user = new User();
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
@@ -510,8 +510,7 @@ class UserController extends Controller
return 0; return 0;
} }
} }
/** /**
* Generate a random string for password. * Generate a random string for password.
* *
@@ -534,5 +533,4 @@ class UserController extends Controller
// return random string // return random string
return $randomString; return $randomString;
} }
} }

View File

@@ -65,7 +65,7 @@ class ArticleController extends Controller
$article = new Article(); $article = new Article();
$articles = $article $articles = $article
->select('id', 'name', 'description', 'publish_time', 'slug') ->select('id', 'name', 'description', 'publish_time', 'slug')
->orderBy('publish_time','desc') ->orderBy('publish_time', 'desc')
->get(); ->get();
// returns chumper datatable // returns chumper datatable
return Datatable::Collection($articles) return Datatable::Collection($articles)

View File

@@ -77,6 +77,7 @@ class CategoryController extends Controller
/* add column name */ /* add column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
$string = strip_tags($model->name); $string = strip_tags($model->name);
return str_limit($string, 20); return str_limit($string, 20);
}) })
/* add column Created */ /* add column Created */
@@ -120,7 +121,7 @@ class CategoryController extends Controller
public function create(Category $category) public function create(Category $category)
{ {
/* Get the all attributes in the category model */ /* Get the all attributes in the category model */
$category = $category->lists('name','id')->toArray(); $category = $category->lists('name', 'id')->toArray();
/* get the view page to create new category with all attributes /* get the view page to create new category with all attributes
of category model */ of category model */
try { try {
@@ -147,6 +148,7 @@ class CategoryController extends Controller
// send success message to index page // send success message to index page
try { try {
$category->fill($request->input())->save(); $category->fill($request->input())->save();
return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully')); return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>'); return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>');
@@ -165,9 +167,9 @@ class CategoryController extends Controller
{ {
/* get the atributes of the category model whose id == $id */ /* get the atributes of the category model whose id == $id */
$category = Category::whereId($id)->first(); $category = Category::whereId($id)->first();
$categories = Category::lists('name','id')->toArray(); $categories = Category::lists('name', 'id')->toArray();
/* get the Edit page the selected category via id */ /* get the Edit page the selected category via id */
return view('themes.default1.agent.kb.category.edit', compact('category','categories')); return view('themes.default1.agent.kb.category.edit', compact('category', 'categories'));
} }
/** /**
@@ -191,6 +193,7 @@ class CategoryController extends Controller
try { try {
$category->slug = $slug; $category->slug = $slug;
$category->fill($request->input())->save(); $category->fill($request->input())->save();
return redirect('category')->with('success', Lang::get('lang.category_updated_successfully')); return redirect('category')->with('success', Lang::get('lang.category_updated_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
//redirect to index with fails message //redirect to index with fails message

View File

@@ -33,8 +33,8 @@ use Illuminate\Support\Collection;
* *
* @version v1 * @version v1
*/ */
class ApiController extends Controller { class ApiController extends Controller
{
public $user; public $user;
public $request; public $request;
public $ticket; public $ticket;
@@ -54,7 +54,8 @@ class ApiController extends Controller {
/** /**
* @param Request $request * @param Request $request
*/ */
public function __construct(Request $request) { public function __construct(Request $request)
{
$this->request = $request; $this->request = $request;
$this->middleware('jwt.auth'); $this->middleware('jwt.auth');
@@ -63,9 +64,7 @@ class ApiController extends Controller {
$user = \JWTAuth::parseToken()->authenticate(); $user = \JWTAuth::parseToken()->authenticate();
$this->user = $user; $this->user = $user;
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) { } catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) { } catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
} }
$ticket = new TicketController(); $ticket = new TicketController();
@@ -120,16 +119,17 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function createTicket() { public function createTicket()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id', 'user_id' => 'required|exists:users,id',
'subject' => 'required', 'subject' => 'required',
'body' => 'required', 'body' => 'required',
'helptopic' => 'required|exists:help_topic,id', 'helptopic' => 'required|exists:help_topic,id',
'sla' => 'required|exists:sla_plan,id', 'sla' => 'required|exists:sla_plan,id',
'priority' => 'required|exists:ticket_priority,priority_id', 'priority' => 'required|exists:ticket_priority,priority_id',
'dept' => 'required|exists:department,id', 'dept' => 'required|exists:department,id',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
@@ -189,11 +189,12 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function ticketReply() { public function ticketReply()
{
//dd($this->request->all()); //dd($this->request->all());
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_ID' => 'required|exists:tickets,id', 'ticket_ID' => 'required|exists:tickets,id',
'reply_content' => 'required', 'reply_content' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
@@ -223,14 +224,15 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function editTicket() { public function editTicket()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_id' => 'required|exists:tickets,id', 'ticket_id' => 'required|exists:tickets,id',
'subject' => 'required', 'subject' => 'required',
'sla_plan' => 'required|exists:sla_plan,id', 'sla_plan' => 'required|exists:sla_plan,id',
'help_topic' => 'required|exists:help_topic,id', 'help_topic' => 'required|exists:help_topic,id',
'ticket_source' => 'required|exists:ticket_source,id', 'ticket_source' => 'required|exists:ticket_source,id',
'ticket_priority' => 'required|exists:ticket_priority,priority_id', 'ticket_priority' => 'required|exists:ticket_priority,priority_id',
]); ]);
if ($v->fails()) { if ($v->fails()) {
@@ -260,7 +262,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function deleteTicket() { public function deleteTicket()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_id' => 'required|exists:tickets,id', 'ticket_id' => 'required|exists:tickets,id',
@@ -293,15 +296,16 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function openedTickets() { public function openedTickets()
{
try { try {
// $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get(); // $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
// return response()->json(compact('result')); // return response()->json(compact('result'));
$result = $this->user->join('tickets', function ($join) { $result = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('isanswered', '=', 0)->where('status', '=', 1)->whereNull('assigned_to'); ->where('isanswered', '=', 0)->where('status', '=', 1)->whereNull('assigned_to');
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -337,15 +341,16 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function unassignedTickets() { public function unassignedTickets()
{
try { try {
//dd('sdhjbc'); //dd('sdhjbc');
// $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get(); // $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
// return response()->json(compact('result')); // return response()->json(compact('result'));
$unassigned = $this->user->join('tickets', function ($join) { $unassigned = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->whereNull('assigned_to')->where('status', '=', 1); ->whereNull('assigned_to')->where('status', '=', 1);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -355,7 +360,7 @@ class ApiController extends Controller {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
@@ -381,15 +386,16 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function closeTickets() { public function closeTickets()
{
try { try {
// $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get(); // $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
// return response()->json(compact('result')); // return response()->json(compact('result'));
$result = $this->user->join('tickets', function ($join) { $result = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('status','=',3)->orWhere('status','=',2); ->where('status', '=', 3)->orWhere('status', '=', 2);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -399,7 +405,7 @@ class ApiController extends Controller {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
@@ -425,7 +431,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getAgents() { public function getAgents()
{
try { try {
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get(); $result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
@@ -448,7 +455,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getTeams() { public function getTeams()
{
try { try {
$result = $this->team->get(); $result = $this->team->get();
@@ -471,11 +479,12 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function assignTicket() { public function assignTicket()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_id' => 'required', 'ticket_id' => 'required',
'user' => 'required', 'user' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
@@ -509,7 +518,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getCustomers() { public function getCustomers()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'search' => 'required', 'search' => 'required',
@@ -520,7 +530,7 @@ class ApiController extends Controller {
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$search = $this->request->input('search'); $search = $this->request->input('search');
$result = $this->faveoUser->where('first_name', 'like', '%' . $search . '%')->orWhere('last_name', 'like', '%' . $search . '%')->orWhere('user_name', 'like', '%' . $search . '%')->orWhere('email', 'like', '%' . $search . '%')->get(); $result = $this->faveoUser->where('first_name', 'like', '%'.$search.'%')->orWhere('last_name', 'like', '%'.$search.'%')->orWhere('user_name', 'like', '%'.$search.'%')->orWhere('email', 'like', '%'.$search.'%')->get();
return response()->json(compact('result')) return response()->json(compact('result'))
->header('X-Header-One', 'Header Value'); ->header('X-Header-One', 'Header Value');
@@ -543,7 +553,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getCustomersWith() { public function getCustomersWith()
{
try { try {
$users = $this->user $users = $this->user
->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id') ->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id')
@@ -574,7 +585,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getCustomer() { public function getCustomer()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required', 'user_id' => 'required',
@@ -606,7 +618,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function searchTicket() { public function searchTicket()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'search' => 'required', 'search' => 'required',
@@ -617,7 +630,7 @@ class ApiController extends Controller {
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$search = $this->request->input('search'); $search = $this->request->input('search');
$result = $this->thread->select('ticket_id')->where('title', 'like', '%' . $search . '%')->orWhere('body', 'like', '%' . $search . '%')->get(); $result = $this->thread->select('ticket_id')->where('title', 'like', '%'.$search.'%')->orWhere('body', 'like', '%'.$search.'%')->get();
return response()->json(compact('result')); return response()->json(compact('result'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -638,7 +651,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function ticketThreads() { public function ticketThreads()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'id' => 'required', 'id' => 'required',
@@ -675,7 +689,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function checkUrl() { public function checkUrl()
{
//dd($this->request); //dd($this->request);
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
@@ -692,7 +707,7 @@ class ApiController extends Controller {
$url = str_finish($url, '/'); $url = str_finish($url, '/');
} }
$url = $url . '/api/v1/helpdesk/check-url?api_key=' . $this->request->input('api_key') . '&token=' . \Config::get('app.token'); $url = $url.'/api/v1/helpdesk/check-url?api_key='.$this->request->input('api_key').'&token='.\Config::get('app.token');
$result = $this->CallGetApi($url); $result = $this->CallGetApi($url);
//dd($result); //dd($result);
return response()->json(compact('result')); return response()->json(compact('result'));
@@ -712,7 +727,8 @@ class ApiController extends Controller {
* *
* @return string * @return string
*/ */
public function urlResult() { public function urlResult()
{
return 'success'; return 'success';
} }
@@ -723,7 +739,8 @@ class ApiController extends Controller {
* *
* @return type int|string|json * @return type int|string|json
*/ */
public function callGetApi($url) { public function callGetApi($url)
{
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
@@ -732,7 +749,7 @@ class ApiController extends Controller {
$response = curl_exec($curl); $response = curl_exec($curl);
if (curl_errno($curl)) { if (curl_errno($curl)) {
echo 'error:' . curl_error($curl); echo 'error:'.curl_error($curl);
} }
return $response; return $response;
@@ -747,7 +764,8 @@ class ApiController extends Controller {
* *
* @return type int|string|json * @return type int|string|json
*/ */
public function callPostApi($url, $data) { public function callPostApi($url, $data)
{
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
@@ -757,7 +775,7 @@ class ApiController extends Controller {
$response = curl_exec($curl); $response = curl_exec($curl);
if (curl_errno($curl)) { if (curl_errno($curl)) {
echo 'error:' . curl_error($curl); echo 'error:'.curl_error($curl);
} }
return $response; return $response;
@@ -769,7 +787,8 @@ class ApiController extends Controller {
* *
* @return type | json * @return type | json
*/ */
public function generateApiKey() { public function generateApiKey()
{
try { try {
$set = $this->setting->where('id', '1')->first(); $set = $this->setting->where('id', '1')->first();
//dd($set); //dd($set);
@@ -803,7 +822,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getHelpTopic() { public function getHelpTopic()
{
try { try {
$result = $this->helptopic->get(); $result = $this->helptopic->get();
@@ -826,7 +846,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getSlaPlan() { public function getSlaPlan()
{
try { try {
$result = $this->slaPlan->get(); $result = $this->slaPlan->get();
@@ -849,7 +870,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getPriority() { public function getPriority()
{
try { try {
$result = $this->priority->get(); $result = $this->priority->get();
@@ -872,7 +894,8 @@ class ApiController extends Controller {
* *
* @return json * @return json
*/ */
public function getDepartment() { public function getDepartment()
{
try { try {
$result = $this->department->get(); $result = $this->department->get();
@@ -895,7 +918,8 @@ class ApiController extends Controller {
* *
* @return type json * @return type json
*/ */
public function getTickets() { public function getTickets()
{
try { try {
$tickets = $this->model->orderBy('created_at', 'desc')->paginate(10); $tickets = $this->model->orderBy('created_at', 'desc')->paginate(10);
$tickets->toJson(); $tickets->toJson();
@@ -919,13 +943,13 @@ class ApiController extends Controller {
* *
* @return type json * @return type json
*/ */
public function inbox() { public function inbox()
{
try { try {
$inbox = $this->user->join('tickets', function ($join) { $inbox = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('status', '=', 1); ->where('status', '=', 1);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -935,7 +959,7 @@ class ApiController extends Controller {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('ticket_thread.title'); ->whereNotNull('ticket_thread.title');
}) })
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'ticket_thread.title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'ticket_thread.title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
@@ -961,12 +985,13 @@ class ApiController extends Controller {
* *
* @return type json * @return type json
*/ */
public function internalNote() { public function internalNote()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'userid' => 'required|exists:users,id', 'userid' => 'required|exists:users,id',
'ticketid' => 'required|exists:tickets,id', 'ticketid' => 'required|exists:tickets,id',
'body' => 'required', 'body' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
@@ -993,12 +1018,13 @@ class ApiController extends Controller {
} }
} }
public function getTrash() { public function getTrash()
{
try { try {
$trash = $this->user->join('tickets', function ($join) { $trash = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('status', '=', 5); ->where('status', '=', 5);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -1008,7 +1034,7 @@ class ApiController extends Controller {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
@@ -1029,7 +1055,8 @@ class ApiController extends Controller {
} }
} }
public function getMyTicketsAgent() { public function getMyTicketsAgent()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id', 'user_id' => 'required|exists:users,id',
@@ -1046,10 +1073,10 @@ class ApiController extends Controller {
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$result = $this->user->join('tickets', function ($join) use ($id) { $result = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.assigned_to') $join->on('users.id', '=', 'tickets.assigned_to')
->where('status', '=', 1); ->where('status', '=', 1);
//->where('user_id', '=', $id); //->where('user_id', '=', $id);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -1059,8 +1086,8 @@ class ApiController extends Controller {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->where('users.id',$id) ->where('users.id', $id)
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
@@ -1081,7 +1108,8 @@ class ApiController extends Controller {
} }
} }
public function getMyTicketsUser() { public function getMyTicketsUser()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id', 'user_id' => 'required|exists:users,id',
@@ -1098,9 +1126,9 @@ class ApiController extends Controller {
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$result = $this->user->join('tickets', function ($join) use ($id) { $result = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('user_id', '=', $id); ->where('user_id', '=', $id);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -1132,7 +1160,8 @@ class ApiController extends Controller {
} }
} }
public function getTicketById() { public function getTicketById()
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'id' => 'required|exists:tickets,id', 'id' => 'required|exists:tickets,id',
@@ -1144,18 +1173,18 @@ class ApiController extends Controller {
} }
$id = $this->request->input('id'); $id = $this->request->input('id');
if (!$this->model->where('id', $id)->first()) { if (!$this->model->where('id', $id)->first()) {
$error = 'There is no Ticket as ticket id: ' . $id; $error = 'There is no Ticket as ticket id: '.$id;
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$query = $this->user->join('tickets', function ($join) use ($id) { $query = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('tickets.id', '=', $id); ->where('tickets.id', '=', $id);
}); });
$response = $this->differenciateHelpTopic($query); $response = $this->differenciateHelpTopic($query);
//$select = 'users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','num_sequence','user_id','priority_id','sla','max_open_ticket','captcha','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','is_transfer','transfer_at','reopened_at','duedate','closed_at','last_message_at','last_response_at'; //$select = 'users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','num_sequence','user_id','priority_id','sla','max_open_ticket','captcha','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','is_transfer','transfer_at','reopened_at','duedate','closed_at','last_message_at','last_response_at';
$result = $response->addSelect('users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','user_id','priority_id','sla','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','reopened_at','duedate','closed_at','last_message_at','last_response_at','tickets.created_at','tickets.updated_at')->first(); $result = $response->addSelect('users.email', 'users.user_name', 'users.first_name', 'users.last_name', 'tickets.id', 'ticket_number', 'user_id', 'priority_id', 'sla', 'status', 'lock_by', 'lock_at', 'source', 'isoverdue', 'reopened', 'isanswered', 'is_deleted', 'closed', 'reopened_at', 'duedate', 'closed_at', 'last_message_at', 'last_response_at', 'tickets.created_at', 'tickets.updated_at')->first();
return response()->json(compact('result')); return response()->json(compact('result'));
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -1171,7 +1200,8 @@ class ApiController extends Controller {
} }
} }
public function createPagination($array, $perPage) { public function createPagination($array, $perPage)
{
try { try {
//Get current page form url e.g. &page=6 //Get current page form url e.g. &page=6
$currentPage = LengthAwarePaginator::resolveCurrentPage(); $currentPage = LengthAwarePaginator::resolveCurrentPage();
@@ -1199,7 +1229,8 @@ class ApiController extends Controller {
} }
} }
public function collaboratorSearch() { public function collaboratorSearch()
{
$this->validate($this->request, ['term' => 'required']); $this->validate($this->request, ['term' => 'required']);
try { try {
$emails = $this->ticket->autosearch(); $emails = $this->ticket->autosearch();
@@ -1209,7 +1240,7 @@ class ApiController extends Controller {
foreach ($emails as $key => $email) { foreach ($emails as $key => $email) {
$user_model = $user->where('email', $email)->first(); $user_model = $user->where('email', $email)->first();
//return $user_model; //return $user_model;
$users[$key]['name'] = $user_model->first_name . ' ' . $user_model->last_name; $users[$key]['name'] = $user_model->first_name.' '.$user_model->last_name;
$users[$key]['email'] = $email; $users[$key]['email'] = $email;
$users[$key]['avatar'] = $this->avatarUrl($email); $users[$key]['avatar'] = $this->avatarUrl($email);
} }
@@ -1226,12 +1257,13 @@ class ApiController extends Controller {
} }
} }
public function avatarUrl($email) { public function avatarUrl($email)
{
try { try {
$user = new User(); $user = new User();
$user = $user->where('email', $email)->first(); $user = $user->where('email', $email)->first();
if ($user->profile_pic) { if ($user->profile_pic) {
$url = url('uploads/profilepic/' . $user->profile_pic); $url = url('uploads/profilepic/'.$user->profile_pic);
} else { } else {
$url = \Gravatar::src($email); $url = \Gravatar::src($email);
} }
@@ -1243,10 +1275,11 @@ class ApiController extends Controller {
} }
} }
public function addCollaboratorForTicket() { public function addCollaboratorForTicket()
{
try { try {
$v = \Validator::make(\Input::get(), [ $v = \Validator::make(\Input::get(), [
'email' => 'required|email|unique:users', 'email' => 'required|email|unique:users',
'ticket_id' => 'required', 'ticket_id' => 'required',
] ]
); );
@@ -1273,7 +1306,8 @@ class ApiController extends Controller {
} }
} }
public function getCollaboratorForTicket() { public function getCollaboratorForTicket()
{
try { try {
$v = \Validator::make(\Input::get(), [ $v = \Validator::make(\Input::get(), [
'ticket_id' => 'required', 'ticket_id' => 'required',
@@ -1302,11 +1336,12 @@ class ApiController extends Controller {
} }
} }
public function deleteCollaborator() { public function deleteCollaborator()
{
try { try {
$v = \Validator::make(\Input::get(), [ $v = \Validator::make(\Input::get(), [
'ticketid' => 'required', 'ticketid' => 'required',
'email' => 'required', 'email' => 'required',
] ]
); );
if ($v->fails()) { if ($v->fails()) {
@@ -1326,7 +1361,8 @@ class ApiController extends Controller {
} }
} }
public function dependency() { public function dependency()
{
try { try {
$department = $this->department->select('name', 'id')->get()->toArray(); $department = $this->department->select('name', 'id')->get()->toArray();
$sla = $this->slaPlan->select('name', 'id')->get()->toArray(); $sla = $this->slaPlan->select('name', 'id')->get()->toArray();
@@ -1337,7 +1373,7 @@ class ApiController extends Controller {
$status = \DB::table('ticket_status')->select('name', 'id')->get(); $status = \DB::table('ticket_status')->select('name', 'id')->get();
$source = \DB::table('ticket_source')->select('name', 'id')->get(); $source = \DB::table('ticket_source')->select('name', 'id')->get();
$result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team, $result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source,]; 'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source, ];
return response()->json(compact('result')); return response()->json(compact('result'));
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -1348,33 +1384,36 @@ class ApiController extends Controller {
return response()->json(compact('error', 'file', 'line')); return response()->json(compact('error', 'file', 'line'));
} }
} }
public function differenciateHelpTopic($query){ public function differenciateHelpTopic($query)
{
$ticket = $query->first(); $ticket = $query->first();
$check = 'department'; $check = 'department';
if($ticket){ if ($ticket) {
if($ticket->dept_id && $ticket->help_topic_id){ if ($ticket->dept_id && $ticket->help_topic_id) {
return $this->getSystem($check, $query); return $this->getSystem($check, $query);
} }
if(!$ticket->dept_id && $ticket->help_topic_id){ if (!$ticket->dept_id && $ticket->help_topic_id) {
return $query->select('tickets.help_topic_id'); return $query->select('tickets.help_topic_id');
} }
if($ticket->dept_id && !$ticket->help_topic_id){ if ($ticket->dept_id && !$ticket->help_topic_id) {
return $query->select('tickets.dept_id'); return $query->select('tickets.dept_id');
} }
} }
} }
public function getSystem($check,$query){ public function getSystem($check, $query)
switch ($check){ {
switch ($check) {
case 'department': case 'department':
return $query->select('tickets.dept_id'); return $query->select('tickets.dept_id');
case 'helpTopic': case 'helpTopic':
return $query->select('tickets.help_topic_id'); return $query->select('tickets.help_topic_id');
default : default:
return $query->select('tickets.dept_id'); return $query->select('tickets.dept_id');
} }
} }
/** /**
* Register a user with username and password. * Register a user with username and password.
* *
@@ -1399,8 +1438,8 @@ class ApiController extends Controller {
$username = $request->input('email'); $username = $request->input('email');
$password = \Hash::make($request->input('password')); $password = \Hash::make($request->input('password'));
$role = $request->input('role'); $role = $request->input('role');
if($auth->role=='agent'){ if ($auth->role == 'agent') {
$role = "user"; $role = 'user';
} }
$user = new User(); $user = new User();
$user->password = $password; $user->password = $password;
@@ -1408,6 +1447,7 @@ class ApiController extends Controller {
$user->email = $email; $user->email = $email;
$user->role = $role; $user->role = $role;
$user->save(); $user->save();
return response()->json(compact('user')); return response()->json(compact('user'));
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
@@ -1415,6 +1455,4 @@ class ApiController extends Controller {
return response()->json(compact('error')); return response()->json(compact('error'));
} }
} }
} }

View File

@@ -98,7 +98,7 @@ class InstallerApiController extends Controller
$ENV['QUEUE_DRIVER'] = 'sync'; $ENV['QUEUE_DRIVER'] = 'sync';
$config = ''; $config = '';
foreach ($ENV as $key => $val) { foreach ($ENV as $key => $val) {
$config .= "{$key}={$val}\n"; $config .= "{$key}={$val}\n";
} }

View File

@@ -5,33 +5,31 @@ namespace App\Http\Controllers\Api\v1;
// Controllers // Controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Requests // Requests
use Illuminate\Http\Request;
// Models
use App\User;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Ticket_Thread;
// Models
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use FCM;
// classes // classes
use LaravelFCM\Message\PayloadNotificationBuilder; use Illuminate\Http\Request;
use LaravelFCM\Message\Topics;
use LaravelFCM\Message\OptionsBuilder; use LaravelFCM\Message\OptionsBuilder;
use LaravelFCM\Message\PayloadDataBuilder; use LaravelFCM\Message\PayloadDataBuilder;
use LaravelFCM\Message\PayloadNotificationBuilder;
use LaravelFCM\Response\DownstreamResponse; use LaravelFCM\Response\DownstreamResponse;
use FCM;
use FCMGroup;
/** /**
* ********************************************** * **********************************************
* PushNotificationController * PushNotificationController
* ********************************************** * **********************************************
* This controller is used to send notification to FCM cloud which later will * This controller is used to send notification to FCM cloud which later will
* foreward notification to Mobile Application * foreward notification to Mobile Application.
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class PushNotificationController extends Controller { class PushNotificationController extends Controller
{
public function Response($token, $body, $ticket_id = null) { public function Response($token, $body, $ticket_id = null)
{
$optionBuiler = new OptionsBuilder(); $optionBuiler = new OptionsBuilder();
$optionBuiler->setTimeToLive(60 * 60); $optionBuiler->setTimeToLive(60 * 60);
@@ -41,8 +39,8 @@ class PushNotificationController extends Controller {
->setIcon('ic_stat_f1') ->setIcon('ic_stat_f1')
->setClickAction('OPEN_ACTIVITY_1'); ->setClickAction('OPEN_ACTIVITY_1');
if($ticket_id != null) { if ($ticket_id != null) {
$ticket_data = Tickets::where('id', '=', $ticket_id )->first(); $ticket_data = Tickets::where('id', '=', $ticket_id)->first();
$thread_data = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first(); $thread_data = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
$dataBuilder = new PayloadDataBuilder(); $dataBuilder = new PayloadDataBuilder();
$dataBuilder->addData(['ticket_id' => $ticket_id]); $dataBuilder->addData(['ticket_id' => $ticket_id]);
@@ -73,21 +71,24 @@ class PushNotificationController extends Controller {
$downstreamResponse->tokensToRetry(); $downstreamResponse->tokensToRetry();
// return Array (key:token, value:errror) - in production you should remove from your database the tokens // return Array (key:token, value:errror) - in production you should remove from your database the tokens
} }
/** /**
* function to get the fcm token from the api under a user. * function to get the fcm token from the api under a user.
*
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return type * @return type
*/ */
public function fcmToken(Request $request, User $user) { public function fcmToken(Request $request, User $user)
// get the requested details {
// get the requested details
$user_id = $request->input('user_id'); $user_id = $request->input('user_id');
$fcm_token = $request->input('fcm_token'); $fcm_token = $request->input('fcm_token');
// check for all the valid details // check for all the valid details
if($user_id != null && $user_id != "" && $fcm_token != null && $fcm_token != "") { if ($user_id != null && $user_id != '' && $fcm_token != null && $fcm_token != '') {
// search the user_id in database // search the user_id in database
$user = $user->where('id', '=', $user_id)->first(); $user = $user->where('id', '=', $user_id)->first();
if($user != null) { if ($user != null) {
$user->fcm_token = $fcm_token; $user->fcm_token = $fcm_token;
$user->save(); $user->save();
// success response for success case // success response for success case
@@ -101,5 +102,4 @@ class PushNotificationController extends Controller {
return ['response' => 'fail', 'reason' => 'Invalid Credentials']; return ['response' => 'fail', 'reason' => 'Invalid Credentials'];
} }
} }
} }

View File

@@ -50,7 +50,7 @@ class TokenAuthController extends Controller
//$credentials = $request->only('email', 'password'); //$credentials = $request->only('email', 'password');
try { try {
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password,'active'=>1])) { if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password, 'active' => 1])) {
return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]); return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]);
} }
} catch (JWTException $e) { } catch (JWTException $e) {

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Auth;
// controllers // controllers
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\LoginRequest; use App\Http\Requests\helpdesk\LoginRequest;
@@ -229,7 +228,7 @@ class AuthController extends Controller
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name'; $field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
// If attempts > 3 and time < 10 minutes // If attempts > 3 and time < 10 minutes
if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60))) { if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60))) {
// //
return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message); return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message);
} }
// If time > 10 minutes, reset attempts counter and time in session // If time > 10 minutes, reset attempts counter and time in session
@@ -244,7 +243,7 @@ class AuthController extends Controller
} }
// If auth ok, redirect to restricted area // If auth ok, redirect to restricted area
\Session::put('loginAttempts', $loginAttempts + 1); \Session::put('loginAttempts', $loginAttempts + 1);
if (Auth::Attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) { if (Auth::Attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) {
if (Auth::user()->role == 'user') { if (Auth::user()->role == 'user') {
return \Redirect::route('/'); return \Redirect::route('/');
@@ -278,15 +277,15 @@ class AuthController extends Controller
if ($data) { if ($data) {
$attempts = $data->Attempts + 1; $attempts = $data->Attempts + 1;
if ($attempts == $apt) { if ($attempts == $apt) {
// $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'"); // $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'");
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts, 'LastLogin' => Date('Y-m-d H:i:s')]); $result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts, 'LastLogin' => date('Y-m-d H:i:s')]);
} else { } else {
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]); $result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]);
// $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'"); // $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'");
} }
} else { } else {
// $result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())"); // $result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())");
$result = DB::table('login_attempts')->update(['Attempts' => 1, 'User' => $field, 'IP' => $value, 'LastLogin' => Date('Y-m-d H:i:s')]); $result = DB::table('login_attempts')->update(['Attempts' => 1, 'User' => $field, 'IP' => $value, 'LastLogin' => date('Y-m-d H:i:s')]);
} }
} }
@@ -329,6 +328,7 @@ class AuthController extends Controller
return 1; return 1;
} else { } else {
$this->clearLoginAttempts($value, $field); $this->clearLoginAttempts($value, $field);
return 0; return 0;
} }
} }

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Auth;
// controllers // controllers
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// request // request
use App\User; use App\User;
@@ -53,7 +52,7 @@ class PasswordController extends Controller
{ {
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$this->validate($request, ['email' => 'required|email']); $this->validate($request, ['email' => 'required|email']);
\Event::fire('reset.password',array()); \Event::fire('reset.password', []);
$user = User::where('email', '=', $request->only('email'))->first(); $user = User::where('email', '=', $request->only('email'))->first();
if (isset($user)) { if (isset($user)) {
$user1 = $user->email; $user1 = $user->email;

View File

@@ -33,15 +33,16 @@ use Redirect;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormController extends Controller { class FormController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* Constructor to check. * Constructor to check.
* *
* @return void * @return void
*/ */
public function __construct(TicketWorkflowController $TicketWorkflowController) { public function __construct(TicketWorkflowController $TicketWorkflowController)
{
$this->middleware('board'); $this->middleware('board');
// creating a TicketController instance // creating a TicketController instance
$this->TicketWorkflowController = $TicketWorkflowController; $this->TicketWorkflowController = $TicketWorkflowController;
@@ -54,7 +55,8 @@ class FormController extends Controller {
* *
* @return type * @return type
*/ */
public function getForm(Help_topic $topic, CountryCode $code) { public function getForm(Help_topic $topic, CountryCode $code)
{
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('licence'); return \Redirect::route('licence');
} }
@@ -66,8 +68,9 @@ class FormController extends Controller {
if ($phonecode->phonecode) { if ($phonecode->phonecode) {
$phonecode = $phonecode->phonecode; $phonecode = $phonecode->phonecode;
} else { } else {
$phonecode = ""; $phonecode = '';
} }
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode); return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
} else { } else {
return \Redirect::route('home'); return \Redirect::route('home');
@@ -82,43 +85,43 @@ class FormController extends Controller {
* *
* @return type string * @return type string
*/ */
public function postForm($id, Help_topic $topic) { public function postForm($id, Help_topic $topic)
{
if ($id != 0) { if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first(); $helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form; $custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get(); $values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) { if (!$values) {
} }
if ($values) { if ($values) {
foreach ($values as $form_data) { foreach ($values as $form_data) {
if ($form_data->type == "select") { if ($form_data->type == 'select') {
$form_fields = explode(',', $form_data->value); $form_fields = explode(',', $form_data->value);
$var = ""; $var = '';
foreach ($form_fields as $form_field) { foreach ($form_fields as $form_field) {
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>'; $var .= '<option value="'.$form_field.'">'.$form_field.'</option>';
} }
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>'; echo '<br/><label>'.ucfirst($form_data->label).'</label><select class="form-control" name="'.$form_data->name.'">'.$var.'</select>';
} elseif ($form_data->type == "radio") { } elseif ($form_data->type == 'radio') {
$type2 = $form_data->value; $type2 = $form_data->value;
$vals = explode(',', $type2); $vals = explode(',', $type2);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>'; echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
foreach ($vals as $val) { foreach ($vals as $val) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $val . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$val.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
} }
echo "<br/>"; echo '<br/>';
} elseif ($form_data->type == "textarea") { } elseif ($form_data->type == 'textarea') {
$type3 = $form_data->value; $type3 = $form_data->value;
echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>'; echo '<br/><label>'.$form_data->label.'</label></br><textarea id="unique-textarea" name="'.$form_data->name.'" class="form-control" style="height:15%;"></textarea>';
} elseif ($form_data->type == "checkbox") { } elseif ($form_data->type == 'checkbox') {
$type4 = $form_data->value; $type4 = $form_data->value;
$checks = explode(',', $type4); $checks = explode(',', $type4);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>'; echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
foreach ($checks as $check) { foreach ($checks as $check) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">&nbsp&nbsp' . $check; echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'">&nbsp&nbsp'.$check;
} }
} else { } else {
echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />'; echo '<br/><label>'.ucfirst($form_data->label).'</label><input type="'.$form_data->type.'" class="form-control" name="'.$form_data->name.'" />';
} }
} }
echo '<br/><br/>'; echo '<br/><br/>';
@@ -134,7 +137,8 @@ class FormController extends Controller {
* @param type Request $request * @param type Request $request
* @param type User $user * @param type User $user
*/ */
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) { public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code)
{
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token'); $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
$name = $request->input('Name'); $name = $request->input('Name');
@@ -146,12 +150,12 @@ class FormController extends Controller {
$mobile_number = $request->input('Mobile'); $mobile_number = $request->input('Mobile');
$status = $ticket_settings->first()->status; $status = $ticket_settings->first()->status;
$helptopic = $request->input('helptopic'); $helptopic = $request->input('helptopic');
$helpTopicObj = Help_topic::where('id','=', $helptopic); $helpTopicObj = Help_topic::where('id', '=', $helptopic);
if($helpTopicObj->exists() && ($helpTopicObj->value('status')==1)){ if ($helpTopicObj->exists() && ($helpTopicObj->value('status') == 1)) {
$department = $helpTopicObj->value('department'); $department = $helpTopicObj->value('department');
}else{ } else {
$defaultHelpTopicID = Ticket::where('id', '=', '1')->first()->help_topic; $defaultHelpTopicID = Ticket::where('id', '=', '1')->first()->help_topic;
$department = Help_topic::where('id','=', $defaultHelpTopicID)->value('department'); $department = Help_topic::where('id', '=', $defaultHelpTopicID)->value('department');
} }
$sla = $ticket_settings->first()->sla; $sla = $ticket_settings->first()->sla;
$priority = $ticket_settings->first()->priority; $priority = $ticket_settings->first()->priority;
@@ -166,8 +170,8 @@ class FormController extends Controller {
$geoipcode = $code->where('iso', '=', $location['isoCode'])->first(); $geoipcode = $code->where('iso', '=', $location['isoCode'])->first();
if ($phonecode == null) { if ($phonecode == null) {
$data = [ $data = [
'fails' => Lang::get('lang.country-code-required-error'), 'fails' => Lang::get('lang.country-code-required-error'),
'phonecode' => $geoipcode->phonecode, 'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1, 'country_code_error' => 1,
]; ];
@@ -176,8 +180,8 @@ class FormController extends Controller {
$code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get(); $code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get();
if (!count($code)) { if (!count($code)) {
$data = [ $data = [
'fails' => Lang::get('lang.incorrect-country-code-error'), 'fails' => Lang::get('lang.incorrect-country-code-error'),
'phonecode' => $geoipcode->phonecode, 'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1, 'country_code_error' => 1,
]; ];
@@ -203,7 +207,7 @@ class FormController extends Controller {
} }
} }
// dd($result); // dd($result);
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ' . Lang::get('lang.Please-save-this-for-future-reference')); return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. '.Lang::get('lang.Please-save-this-for-future-reference'));
} }
// dd($result); // dd($result);
} }
@@ -215,13 +219,14 @@ class FormController extends Controller {
* *
* @return type view * @return type view
*/ */
public function post_ticket_reply($id, Request $request) { public function post_ticket_reply($id, Request $request)
{
try { try {
if ($comment != null) { if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first(); $tickets = Tickets::where('id', '=', $id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first(); $thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
$subject = $thread->title . '[#' . $tickets->ticket_number . ']'; $subject = $thread->title.'[#'.$tickets->ticket_number.']';
$body = $request->input('comment'); $body = $request->input('comment');
$user_cred = User::where('id', '=', $tickets->user_id)->first(); $user_cred = User::where('id', '=', $tickets->user_id)->first();
@@ -255,13 +260,14 @@ class FormController extends Controller {
} }
} }
public function getCustomForm(Request $request) { public function getCustomForm(Request $request)
$html = ""; {
$html = '';
$helptopic_id = $request->input('helptopic'); $helptopic_id = $request->input('helptopic');
$helptopics = new Help_topic(); $helptopics = new Help_topic();
$helptopic = $helptopics->find($helptopic_id); $helptopic = $helptopics->find($helptopic_id);
if (!$helptopic) { if (!$helptopic) {
throw new Exception("We can not find your request"); throw new Exception('We can not find your request');
} }
$custom_form = $helptopic->custom_form; $custom_form = $helptopic->custom_form;
if ($custom_form) { if ($custom_form) {
@@ -270,7 +276,7 @@ class FormController extends Controller {
$form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms); $form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms);
$html = $form_controller->renderForm($custom_form); $html = $form_controller->renderForm($custom_form);
} }
return $html; return $html;
} }
}
}

View File

@@ -11,12 +11,12 @@ use App\Http\Requests\helpdesk\ProfileRequest;
use App\Http\Requests\helpdesk\TicketRequest; use App\Http\Requests\helpdesk\TicketRequest;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
// models // models
use App\Model\helpdesk\Settings\CommonSettings;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Utility\CountryCode; use App\Model\helpdesk\Utility\CountryCode;
use App\Model\helpdesk\Settings\CommonSettings;
use App\User; use App\User;
use Auth; use Auth;
// classes // classes
@@ -323,6 +323,7 @@ class GuestController extends Controller
$common_setting = $common_settings->select('status') $common_setting = $common_settings->select('status')
->where('option_name', '=', 'user_set_ticket_status') ->where('option_name', '=', 'user_set_ticket_status')
->first(); ->first();
return view('themes.default1.client.helpdesk.ckeckticket', compact('id', 'common_setting')); return view('themes.default1.client.helpdesk.ckeckticket', compact('id', 'common_setting'));
} }

View File

@@ -24,9 +24,10 @@ use Lang;
use Mail; use Mail;
use Redirect; use Redirect;
class UserController extends Controller { class UserController extends Controller
{
public function __construct() { public function __construct()
{
$this->middleware('board'); $this->middleware('board');
} }
@@ -35,18 +36,20 @@ class UserController extends Controller {
* *
* @return response * @return response
*/ */
public function getArticle(Article $article, Category $category, Settings $settings) { public function getArticle(Article $article, Category $category, Settings $settings)
{
$setting = $settings->first(); $setting = $settings->first();
$pagination = $setting->pagination; $pagination = $setting->pagination;
if (!Auth::check() || \Auth::user()->role == 'user') { if (!Auth::check() || \Auth::user()->role == 'user') {
$article = $article->where('status', '1'); $article = $article->where('status', '1');
} }
$article = $article->where('type', '1'); $article = $article->where('type', '1');
$article = $article->orderBy('publish_time','desc'); $article = $article->orderBy('publish_time', 'desc');
$article = $article->paginate($pagination); $article = $article->paginate($pagination);
$article->setPath('article-list'); $article->setPath('article-list');
$categorys = $category->get(); $categorys = $category->get();
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article')); return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
} }
@@ -59,7 +62,8 @@ class UserController extends Controller {
* *
* @return string excerpt * @return string excerpt
*/ */
public static function getExcerpt($str, $startPos = 0, $maxLength = 50) { public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
{
if (strlen($str) > $maxLength) { if (strlen($str) > $maxLength) {
$excerpt = substr($str, $startPos, $maxLength - 3); $excerpt = substr($str, $startPos, $maxLength - 3);
$lastSpace = strrpos($excerpt, ' '); $lastSpace = strrpos($excerpt, ' ');
@@ -82,13 +86,14 @@ class UserController extends Controller {
* *
* @return type view * @return type view
*/ */
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) { public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
{
$settings = $settings->first(); $settings = $settings->first();
$pagination = $settings->pagination; $pagination = $settings->pagination;
$search = $request->input('s'); $search = $request->input('s');
$result = $article->where('name', 'LIKE', '%' . $search . '%') $result = $article->where('name', 'LIKE', '%'.$search.'%')
->orWhere('slug', 'LIKE', '%' . $search . '%') ->orWhere('slug', 'LIKE', '%'.$search.'%')
->orWhere('description', 'LIKE', '%' . $search . '%') ->orWhere('description', 'LIKE', '%'.$search.'%')
->paginate($pagination); ->paginate($pagination);
$result->setPath('search'); $result->setPath('search');
$categorys = $category->get(); $categorys = $category->get();
@@ -101,15 +106,16 @@ class UserController extends Controller {
* *
* @return response * @return response
*/ */
public function show($slug, Article $article, Category $category) { public function show($slug, Article $article, Category $category)
{
//ArticleController::timezone(); //ArticleController::timezone();
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone; $tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name; $tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
date_default_timezone_set($tz); date_default_timezone_set($tz);
$date = \Carbon\Carbon::now()->toDateTimeString(); $date = \Carbon\Carbon::now()->toDateTimeString();
$arti = $article->where('slug', $slug); $arti = $article->where('slug', $slug);
if (!Auth::check()|| \Auth::user()->role == 'user') { if (!Auth::check() || \Auth::user()->role == 'user') {
$arti = $arti->where('status', '1'); $arti = $arti->where('status', '1');
$arti = $arti->where('publish_time', '<', $date); $arti = $arti->where('publish_time', '<', $date);
} }
@@ -125,7 +131,8 @@ class UserController extends Controller {
} }
} }
public function getCategory($slug, Article $article, Category $category, Relationship $relation) { public function getCategory($slug, Article $article, Category $category, Relationship $relation)
{
/* get the article_id where category_id == current category */ /* get the article_id where category_id == current category */
$catid = $category->where('slug', $slug)->first(); $catid = $category->where('slug', $slug)->first();
if (!$catid) { if (!$catid) {
@@ -141,7 +148,8 @@ class UserController extends Controller {
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id')); return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
} }
public function home(Article $article, Category $category, Relationship $relation) { public function home(Article $article, Category $category, Relationship $relation)
{
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return redirect('step1'); return redirect('step1');
} else { } else {
@@ -153,7 +161,8 @@ class UserController extends Controller {
} }
} }
public function Faq(Faq $faq, Category $category) { public function Faq(Faq $faq, Category $category)
{
$faq = $faq->where('id', '1')->first(); $faq = $faq->where('id', '1')->first();
$categorys = $category->get(); $categorys = $category->get();
@@ -165,7 +174,8 @@ class UserController extends Controller {
* *
* @return response * @return response
*/ */
public function contact(Category $category, Settings $settings) { public function contact(Category $category, Settings $settings)
{
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
$categorys = $category->get(); $categorys = $category->get();
@@ -177,7 +187,8 @@ class UserController extends Controller {
* *
* @return response * @return response
*/ */
public function postContact(ContactRequest $request, Contact $contact) { public function postContact(ContactRequest $request, Contact $contact)
{
$this->port(); $this->port();
$this->host(); $this->host();
$this->encryption(); $this->encryption();
@@ -195,8 +206,8 @@ class UserController extends Controller {
//echo $message; //echo $message;
//echo $contact->email; //echo $contact->email;
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) { $mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) {
$message->to($contact->email, $contact->name)->subject('Contact'); $message->to($contact->email, $contact->name)->subject('Contact');
}); });
if ($mail) { if ($mail) {
return redirect('contact')->with('success', Lang::get('lang.your_details_send_to_system')); return redirect('contact')->with('success', Lang::get('lang.your_details_send_to_system'));
} else { } else {
@@ -204,7 +215,8 @@ class UserController extends Controller {
} }
} }
public function contactDetails() { public function contactDetails()
{
return view('themes.default1.client.kb.article-list.contact-details'); return view('themes.default1.client.kb.article-list.contact-details');
} }
@@ -218,10 +230,11 @@ class UserController extends Controller {
* *
* @return type response * @return type response
*/ */
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) { public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
{
$article = $article->where('slug', $slug)->first(); $article = $article->where('slug', $slug)->first();
if(!$article){ if (!$article) {
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed')); return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
} }
$id = $article->id; $id = $article->id;
$comment->article_id = $id; $comment->article_id = $id;
@@ -232,42 +245,49 @@ class UserController extends Controller {
} }
} }
public function getPage($name, Page $page) { public function getPage($name, Page $page)
{
$page = $page->where('slug', $name)->first(); $page = $page->where('slug', $name)->first();
if($page){ if ($page) {
return view('themes.default1.client.kb.article-list.pages', compact('page')); return view('themes.default1.client.kb.article-list.pages', compact('page'));
}else{ } else {
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed')); return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
} }
} }
public static function port() { public static function port()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set('mail.port', $setting->port); Config::set('mail.port', $setting->port);
} }
public static function host() { public static function host()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set('mail.host', $setting->host); Config::set('mail.host', $setting->host);
} }
public static function encryption() { public static function encryption()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]); Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
} }
public static function email() { public static function email()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]); Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
//dd(Config::get('mail')); //dd(Config::get('mail'));
} }
public static function password() { public static function password()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]); Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
} }
public function getCategoryList(Article $article, Category $category, Relationship $relation) { public function getCategoryList(Article $article, Category $category, Relationship $relation)
{
//$categorys = $category->get(); //$categorys = $category->get();
$categorys = $category->get(); $categorys = $category->get();
// $categorys->setPath('home'); // $categorys->setPath('home');
@@ -289,13 +309,15 @@ class UserController extends Controller {
// //return substr($date, 0, -6); // //return substr($date, 0, -6);
// } // }
public function clientProfile() { public function clientProfile()
{
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.client.kb.article-list.profile', compact('user')); return view('themes.default1.client.kb.article-list.profile', compact('user'));
} }
public function postClientProfile($id, ProfileRequest $request) { public function postClientProfile($id, ProfileRequest $request)
{
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
@@ -314,7 +336,7 @@ class UserController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
@@ -328,7 +350,8 @@ class UserController extends Controller {
} }
} }
public function postClientProfilePassword($id, ProfilePassword $request) { public function postClientProfilePassword($id, ProfilePassword $request)
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
@@ -340,5 +363,4 @@ class UserController extends Controller {
return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated')); return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated'));
} }
} }
} }

View File

@@ -4,9 +4,10 @@ namespace App\Http\Controllers\Common;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
class FileuploadController extends Controller { class FileuploadController extends Controller
{
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if role is agent // checking if role is agent
@@ -15,7 +16,8 @@ class FileuploadController extends Controller {
// Returns a file size limit in bytes based on the PHP upload_max_filesize // Returns a file size limit in bytes based on the PHP upload_max_filesize
// and post_max_size // and post_max_size
function file_upload_max_size() { public function file_upload_max_size()
{
static $max_size = -1; static $max_size = -1;
if ($max_size < 0) { if ($max_size < 0) {
@@ -31,11 +33,13 @@ class FileuploadController extends Controller {
$max_size_in_actual = ini_get('upload_max_filesize'); $max_size_in_actual = ini_get('upload_max_filesize');
} }
} }
return ['0' => $max_size_in_bytes, '1' => $max_size_in_actual]; return ['0' => $max_size_in_bytes, '1' => $max_size_in_actual];
// return $max_size_in_bytes; // return $max_size_in_bytes;
} }
function parse_size($size) { public function parse_size($size)
{
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size. $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
$size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size. $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
if ($unit) { if ($unit) {
@@ -45,5 +49,4 @@ class FileuploadController extends Controller {
return round($size); return round($size);
} }
} }
} }

View File

@@ -2,34 +2,35 @@
namespace App\Http\Controllers\Common; namespace App\Http\Controllers\Common;
use App\Http\Controllers\Api\v1\PushNotificationController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Model\helpdesk\Notification\Notification; use App\Model\helpdesk\Notification\Notification;
use App\Model\helpdesk\Notification\NotificationType;
use App\Model\helpdesk\Notification\UserNotification; use App\Model\helpdesk\Notification\UserNotification;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\User; use App\User;
use App\Http\Controllers\Api\v1\PushNotificationController;
use App\Model\helpdesk\Notification\NotificationType;
class NotificationController extends Controller { class NotificationController extends Controller
{
/** /**
********************************************* *********************************************
* Class Notification Controller * Class Notification Controller
********************************************* *********************************************
* This controller is used to generate in app notification * This controller is used to generate in app notification
* under the folling occurrence * under the folling occurrence
* 1. Ticket Creation * 1. Ticket Creation
* 2. Ticket Reply * 2. Ticket Reply
* 3. User Creation * 3. User Creation.
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
public $user; public $user;
/** /**
* Constructor * Constructor.
*/ */
public function __construct(PushNotificationController $PushNotificationController) { public function __construct(PushNotificationController $PushNotificationController)
{
$this->PushNotificationController = $PushNotificationController; $this->PushNotificationController = $PushNotificationController;
$user = new User(); $user = new User();
$this->user = $user; $this->user = $user;
@@ -41,12 +42,14 @@ class NotificationController extends Controller {
/** /**
* This function is used to create in app notifications. * This function is used to create in app notifications.
*
* @param type $model_id * @param type $model_id
* @param type $userid_created * @param type $userid_created
* @param type $type_id * @param type $type_id
* @param type $forwhome * @param type $forwhome
*/ */
public function create($model_id, $userid_created, $type_id, $forwhome = []) { public function create($model_id, $userid_created, $type_id, $forwhome = [])
{
try { try {
if (empty($forwhome)) { if (empty($forwhome)) {
$ticket = Tickets::where('id', '=', $model_id)->first(); $ticket = Tickets::where('id', '=', $model_id)->first();
@@ -67,48 +70,62 @@ class NotificationController extends Controller {
} }
/** /**
* This function is to mark all ticket to read status * This function is to mark all ticket to read status.
*
* @param type $id * @param type $id
*
* @return int * @return int
*/ */
public function markAllRead($id) { public function markAllRead($id)
{
$markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get(); $markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) { foreach ($markasread as $mark) {
$mark->is_read = '1'; $mark->is_read = '1';
$mark->save(); $mark->save();
} }
return 1; return 1;
} }
/** /**
* This function to mark read * This function to mark read.
*
* @param type $id * @param type $id
*
* @return int * @return int
*/ */
public function markRead($id) { public function markRead($id)
{
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get(); $markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) { foreach ($markasread as $mark) {
$mark->is_read = '1'; $mark->is_read = '1';
$mark->save(); $mark->save();
} }
return 1; return 1;
} }
/** /**
* function to show all the notifications * function to show all the notifications.
*
* @return type * @return type
*/ */
public function show() { public function show()
{
$notifications = $this->getNotifications(); $notifications = $this->getNotifications();
return view('notifications-all', compact('notifications')); return view('notifications-all', compact('notifications'));
} }
/** /**
* function to delete notifications * function to delete notifications.
*
* @param type $id * @param type $id
*
* @return int * @return int
*/ */
public function delete($id) { public function delete($id)
{
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get(); $markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get();
foreach ($markasread as $mark) { foreach ($markasread as $mark) {
$mark->delete(); $mark->delete();
@@ -119,14 +136,16 @@ class NotificationController extends Controller {
/** /**
* get the page to list the notifications. * get the page to list the notifications.
*
* @return response * @return response
*/ */
public static function getNotifications() { public static function getNotifications()
{
$notifications = UserNotification::join('notifications', 'user_notification.notification_id', '=', 'notifications.id') $notifications = UserNotification::join('notifications', 'user_notification.notification_id', '=', 'notifications.id')
->join('notification_types', 'notifications.type_id', '=', 'notification_types.id') ->join('notification_types', 'notifications.type_id', '=', 'notification_types.id')
->where('user_notification.user_id', '=', \Auth::user()->id) ->where('user_notification.user_id', '=', \Auth::user()->id)
->paginate(10); ->paginate(10);
return $notifications; return $notifications;
} }
} }

View File

@@ -6,16 +6,18 @@ use App\Http\Controllers\Controller;
use App\Model\Common\TemplateType; use App\Model\Common\TemplateType;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\CommonSettings;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Settings\CommonSettings;
use App\User; use App\User;
use Auth; use Auth;
class PhpMailController extends Controller { class PhpMailController extends Controller
{
public function fetch_smtp_details($id) { public function fetch_smtp_details($id)
{
$emails = Emails::where('id', '=', $id)->first(); $emails = Emails::where('id', '=', $id)->first();
return $emails; return $emails;
} }
@@ -24,42 +26,43 @@ class PhpMailController extends Controller {
* *
* @return Mail * @return Mail
*/ */
public function sendmail($from, $to, $message, $template_variables) { public function sendmail($from, $to, $message, $template_variables)
// try { {
// try {
// dd($from); // dd($from);
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
if ($from_address == null) { if ($from_address == null) {
return $from_address; return $from_address;
} else { } else {
// dd($from_address); // dd($from_address);
$username = $from_address->email_address; $username = $from_address->email_address;
$fromname = $from_address->email_name; $fromname = $from_address->email_name;
$password = \Crypt::decrypt($from_address->password); $password = \Crypt::decrypt($from_address->password);
$smtpsecure = $from_address->sending_encryption; $smtpsecure = $from_address->sending_encryption;
$host = $from_address->sending_host; $host = $from_address->sending_host;
$port = $from_address->sending_port; $port = $from_address->sending_port;
$protocol = $from_address->sending_protocol; $protocol = $from_address->sending_protocol;
if (isset($to['email'])) { if (isset($to['email'])) {
$recipants = $to['email']; $recipants = $to['email'];
} else { } else {
$recipants = null; $recipants = null;
} }
if (isset($to['name'])) { if (isset($to['name'])) {
$recipantname = $to['name']; $recipantname = $to['name'];
} else { } else {
$recipantname = null; $recipantname = null;
} }
if (isset($to['cc'])) { if (isset($to['cc'])) {
$cc = $to['cc']; $cc = $to['cc'];
} else { } else {
$cc = null; $cc = null;
} }
if (isset($to['bc'])) { if (isset($to['bc'])) {
$bc = $to['bc']; $bc = $to['bc'];
} else { } else {
$bc = null; $bc = null;
} }
// if (isset($message['subject'])) { // if (isset($message['subject'])) {
// $subject = $message['subject']; // $subject = $message['subject'];
// } else { // } else {
@@ -70,16 +73,16 @@ class PhpMailController extends Controller {
} else { } else {
$content = null; $content = null;
} }
if (isset($message['scenario'])) { if (isset($message['scenario'])) {
$template = $message['scenario']; $template = $message['scenario'];
} else { } else {
$template = null; $template = null;
} }
if (isset($message['attachments'])) { if (isset($message['attachments'])) {
$attachment = $message['attachments']; $attachment = $message['attachments'];
} else { } else {
$attachment = null; $attachment = null;
} }
// template variables // template variables
if (Auth::user()) { if (Auth::user()) {
@@ -87,86 +90,86 @@ class PhpMailController extends Controller {
} else { } else {
$agent = null; $agent = null;
} }
if (isset($template_variables['ticket_agent_name'])) { if (isset($template_variables['ticket_agent_name'])) {
$ticket_agent_name = $template_variables['ticket_agent_name']; $ticket_agent_name = $template_variables['ticket_agent_name'];
} else { } else {
$ticket_agent_name = null; $ticket_agent_name = null;
} }
if (isset($template_variables['ticket_number'])) { if (isset($template_variables['ticket_number'])) {
$ticket_number = $template_variables['ticket_number']; $ticket_number = $template_variables['ticket_number'];
} else { } else {
$ticket_number = null; $ticket_number = null;
} }
if (isset($template_variables['ticket_client_name'])) { if (isset($template_variables['ticket_client_name'])) {
$ticket_client_name = $template_variables['ticket_client_name']; $ticket_client_name = $template_variables['ticket_client_name'];
} else { } else {
$ticket_client_name = null; $ticket_client_name = null;
} }
if (isset($template_variables['ticket_client_email'])) { if (isset($template_variables['ticket_client_email'])) {
$ticket_client_email = $template_variables['ticket_client_email']; $ticket_client_email = $template_variables['ticket_client_email'];
} else { } else {
$ticket_client_email = null; $ticket_client_email = null;
} }
if (isset($template_variables['ticket_body'])) { if (isset($template_variables['ticket_body'])) {
$ticket_body = $template_variables['ticket_body']; $ticket_body = $template_variables['ticket_body'];
} else { } else {
$ticket_body = null; $ticket_body = null;
} }
if (isset($template_variables['ticket_assigner'])) { if (isset($template_variables['ticket_assigner'])) {
$ticket_assigner = $template_variables['ticket_assigner']; $ticket_assigner = $template_variables['ticket_assigner'];
} else { } else {
$ticket_assigner = null; $ticket_assigner = null;
} }
if (isset($template_variables['ticket_link_with_number'])) { if (isset($template_variables['ticket_link_with_number'])) {
$ticket_link_with_number = $template_variables['ticket_link_with_number']; $ticket_link_with_number = $template_variables['ticket_link_with_number'];
} else { } else {
$ticket_link_with_number = null; $ticket_link_with_number = null;
} }
if (isset($template_variables['system_from'])) { if (isset($template_variables['system_from'])) {
$system_from = $template_variables['system_from']; $system_from = $template_variables['system_from'];
} else { } else {
$system_from = $this->company(); $system_from = $this->company();
} }
if (isset($template_variables['system_link'])) { if (isset($template_variables['system_link'])) {
$system_link = $template_variables['system_link']; $system_link = $template_variables['system_link'];
} else { } else {
$system_link = url('/'); $system_link = url('/');
} }
if (isset($template_variables['system_error'])) { if (isset($template_variables['system_error'])) {
$system_error = $template_variables['system_error']; $system_error = $template_variables['system_error'];
} else { } else {
$system_error = null; $system_error = null;
} }
if (isset($template_variables['agent_sign'])) { if (isset($template_variables['agent_sign'])) {
$agent_sign = $template_variables['agent_sign']; $agent_sign = $template_variables['agent_sign'];
} else { } else {
$agent_sign = null; $agent_sign = null;
} }
if (isset($template_variables['department_sign'])) { if (isset($template_variables['department_sign'])) {
$department_sign = $template_variables['department_sign']; $department_sign = $template_variables['department_sign'];
} else { } else {
$department_sign = null; $department_sign = null;
} }
if (isset($template_variables['password_reset_link'])) { if (isset($template_variables['password_reset_link'])) {
$password_reset_link = $template_variables['password_reset_link']; $password_reset_link = $template_variables['password_reset_link'];
} else { } else {
$password_reset_link = null; $password_reset_link = null;
} }
if (isset($template_variables['user_password'])) { if (isset($template_variables['user_password'])) {
$user_password = $template_variables['user_password']; $user_password = $template_variables['user_password'];
} else { } else {
$user_password = null; $user_password = null;
} }
if (isset($template_variables['email_address'])) { if (isset($template_variables['email_address'])) {
$email_address = $template_variables['email_address']; $email_address = $template_variables['email_address'];
} else { } else {
$email_address = null; $email_address = null;
} }
if (isset($template_variables['user'])) { if (isset($template_variables['user'])) {
$user = $template_variables['user']; $user = $template_variables['user'];
} else { } else {
$user = null; $user = null;
} }
// $system_link = url('/'); // $system_link = url('/');
@@ -174,9 +177,9 @@ class PhpMailController extends Controller {
$mail = new \PHPMailer(); $mail = new \PHPMailer();
$status = \DB::table('settings_email')->first(); $status = \DB::table('settings_email')->first();
$path2 = \Config::get('view.paths'); $path2 = \Config::get('view.paths');
// $directory = $path2[0].DIRECTORY_SEPARATOR.'emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR; // $directory = $path2[0].DIRECTORY_SEPARATOR.'emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
// //
@@ -186,31 +189,31 @@ class PhpMailController extends Controller {
$template = TemplateType::where('name', '=', $template)->first(); $template = TemplateType::where('name', '=', $template)->first();
$set = \App\Model\Common\TemplateSet::where('name', '=', $status->template)->first(); $set = \App\Model\Common\TemplateSet::where('name', '=', $status->template)->first();
if (isset($set['id'])) { if (isset($set['id'])) {
$template_data = \App\Model\Common\Template::where('set_id', '=', $set->id)->where('type', '=', $template->id)->first(); $template_data = \App\Model\Common\Template::where('set_id', '=', $set->id)->where('type', '=', $template->id)->first();
$contents = $template_data->message; $contents = $template_data->message;
if ($template_data->variable == 1) { if ($template_data->variable == 1) {
if ($template_data->subject) { if ($template_data->subject) {
$subject = $template_data->subject; $subject = $template_data->subject;
if ($ticket_number != null) { if ($ticket_number != null) {
$subject = $subject . ' [#' . $ticket_number . ']'; $subject = $subject.' [#'.$ticket_number.']';
}
} else {
$subject = $message['subject'];
} }
} else { } else {
$subject = $message['subject']; $subject = $message['subject'];
} }
} else { } else {
$contents = null; $subject = $message['subject'];
$subject = null;
} }
} else {
$contents = null;
$subject = null;
}
$variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}']; $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}'];
$data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link]; $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link];
// dd($variables,$data,$contents); // dd($variables,$data,$contents);
// $messagebody = str_replace($variables, $data, $contents); // $messagebody = str_replace($variables, $data, $contents);
@@ -241,7 +244,7 @@ class PhpMailController extends Controller {
$mail->setFrom($username, $fromname); $mail->setFrom($username, $fromname);
} }
} }
$mail->addAddress($recipants); // Add a recipient $mail->addAddress($recipants); // Add a recipient
$mail->isHTML(true); // Set email format to HTML $mail->isHTML(true); // Set email format to HTML
if ($cc != null) { if ($cc != null) {
foreach ($cc as $collaborator) { foreach ($cc as $collaborator) {
@@ -253,37 +256,37 @@ class PhpMailController extends Controller {
} }
} }
if ($attachment != null) { if ($attachment != null) {
$size = count($message['attachments']); $size = count($message['attachments']);
$attach = $message['attachments']; $attach = $message['attachments'];
for ($i = 0; $i < $size; $i++) { for ($i = 0; $i < $size; $i++) {
$file_path = $attach[$i]->getRealPath(); $file_path = $attach[$i]->getRealPath();
$file_name = $attach[$i]->getClientOriginalName(); $file_name = $attach[$i]->getClientOriginalName();
$mail->addAttachment($file_path, $file_name); $mail->addAttachment($file_path, $file_name);
}
}
$mail->CharSet = "utf8";
$mail->Subject = $subject;
if ($template == 'ticket-reply-agent') {
$line = '---Reply above this line--- <br/><br/>';
$body = $line . $messagebody;
} else {
$body = $messagebody;
}
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if($rtl->option_value == 1) {
$mail->ContentType = 'text/html';
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>';
} else {
}
$mail->Body = nl2br($body);
if (!$mail->send()) {
return;
} else {
return 1;
} }
} }
$mail->CharSet = 'utf8';
$mail->Subject = $subject;
if ($template == 'ticket-reply-agent') {
$line = '---Reply above this line--- <br/><br/>';
$body = $line.$messagebody;
} else {
$body = $messagebody;
}
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if ($rtl->option_value == 1) {
$mail->ContentType = 'text/html';
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">'.$body.'</body></html>';
} else {
}
$mail->Body = nl2br($body);
if (!$mail->send()) {
return;
} else {
return 1;
}
}
} }
/** /**
@@ -291,7 +294,8 @@ class PhpMailController extends Controller {
* *
* @return MailNotification * @return MailNotification
*/ */
public function sendEmail($from, $to, $message) { public function sendEmail($from, $to, $message)
{
try { try {
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
if ($from_address == null) { if ($from_address == null) {
@@ -403,7 +407,7 @@ class PhpMailController extends Controller {
$mail->addAttachment($file_path, $file_name); $mail->addAttachment($file_path, $file_name);
} }
} }
$mail->CharSet = "utf8"; $mail->CharSet = 'utf8';
$mail->Subject = $subject; $mail->Subject = $subject;
$mail->Body = $content; $mail->Body = $content;
if (!$mail->send()) { if (!$mail->send()) {
@@ -411,9 +415,9 @@ class PhpMailController extends Controller {
} }
} }
} catch (Exception $e) { } catch (Exception $e) {
if($e instanceof ErrorException) { if ($e instanceof ErrorException) {
return \Lang::get('lang.outgoing_email_failed'); return \Lang::get('lang.outgoing_email_failed');
} }
} }
} }
@@ -422,7 +426,8 @@ class PhpMailController extends Controller {
* *
* @return type * @return type
*/ */
public function company() { public function company()
{
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = 'Support Center'; $company = 'Support Center';
@@ -441,7 +446,8 @@ class PhpMailController extends Controller {
* *
* @return type integer * @return type integer
*/ */
public function mailfrom($reg, $dept_id) { public function mailfrom($reg, $dept_id)
{
$email = Email::where('id', '=', '1')->first(); $email = Email::where('id', '=', '1')->first();
if ($reg == 1) { if ($reg == 1) {
return $email->sys_email; return $email->sys_email;
@@ -454,5 +460,4 @@ class PhpMailController extends Controller {
} }
} }
} }
}
}

View File

@@ -5,39 +5,35 @@ namespace App\Http\Controllers\Common;
// Controllers // Controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Requests // Requests
use Illuminate\Http\Request;
// Models
use App\User; use App\User;
// classes // Models
use LaravelFCM\Message\PayloadNotificationBuilder;
use LaravelFCM\Message\Topics;
use LaravelFCM\Message\OptionsBuilder;
use LaravelFCM\Message\PayloadDataBuilder;
use LaravelFCM\Response\DownstreamResponse;
use FCM; use FCM;
use FCMGroup; // classes
use Illuminate\Http\Request;
/** /**
* ********************************************** * **********************************************
* PushNotificationController * PushNotificationController
* ********************************************** * **********************************************
* This controller is used to send notification to FCM cloud which later will * This controller is used to send notification to FCM cloud which later will
* foreward notification to Mobile Application * foreward notification to Mobile Application.
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class PushNotificationController extends Controller { class PushNotificationController extends Controller
{
public function response($token, User $user) { public function response($token, User $user)
{
} }
/** /**
* function to get the fcm token from the api under a user. * function to get the fcm token from the api under a user.
*
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return type * @return type
*/ */
public function fcmToken(Request $request, User $user) { public function fcmToken(Request $request, User $user)
{
} }
} }

View File

@@ -11,7 +11,6 @@ use App\Model\helpdesk\Email\Smtp;
// models // models
use App\Model\helpdesk\Settings\Plugin; use App\Model\helpdesk\Settings\Plugin;
use App\Model\helpdesk\Theme\Widgets; use App\Model\helpdesk\Theme\Widgets;
use App\Model\helpdesk\Utility\Version_Check;
use Config; use Config;
// classes // classes
use Crypt; use Crypt;
@@ -27,14 +26,15 @@ use Lang;
* *************************** * ***************************
* Controller to keep smtp details and fetch where ever needed. * Controller to keep smtp details and fetch where ever needed.
*/ */
class SettingsController extends Controller { class SettingsController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
@@ -44,7 +44,8 @@ class SettingsController extends Controller {
* *
* @return response * @return response
*/ */
public function widgets() { public function widgets()
{
return view('themes.default1.admin.helpdesk.theme.widgets'); return view('themes.default1.admin.helpdesk.theme.widgets');
} }
@@ -53,7 +54,8 @@ class SettingsController extends Controller {
* *
* @return response * @return response
*/ */
public function list_widget() { public function list_widget()
{
return \Datatable::collection(Widgets::where('id', '<', '7')->get()) return \Datatable::collection(Widgets::where('id', '<', '7')->get())
->searchColumns('name') ->searchColumns('name')
->orderColumns('name', 'title', 'value') ->orderColumns('name', 'title', 'value')
@@ -67,33 +69,33 @@ class SettingsController extends Controller {
return $model->value; return $model->value;
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span> return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
<div class="modal fade" id="edit_widget' . $model->id . '"> <div class="modal fade" id="edit_widget'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="' . url('edit-widget/' . $model->id) . '" method="POST"> <form action="'.url('edit-widget/'.$model->id).'" method="POST">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4> <h4 class="modal-title">'.strtoupper($model->name).' </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>' . \Lang::get('lang.title') . '</label><br/> <label>'.\Lang::get('lang.title').'</label><br/>
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%"> <input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%">
</div> </div>
<br/> <br/>
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>' . \Lang::get('lang.content') . '</label><br/> <label>'.\Lang::get('lang.content').'</label><br/>
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea> <textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '"> <input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
</div> </div>
<script> <script>
$(function () { $(function () {
$("#Content' . $model->id . '").wysihtml5(); $("#Content'.$model->id.'").wysihtml5();
}); });
</script> </script>
</form> </form>
@@ -112,13 +114,15 @@ class SettingsController extends Controller {
* *
* @return type response * @return type response
*/ */
public function edit_widget($id, Widgets $widgets, Request $request) { public function edit_widget($id, Widgets $widgets, Request $request)
{
$widget = $widgets->where('id', '=', $id)->first(); $widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title; $widget->title = $request->title;
$widget->value = $request->content; $widget->value = $request->content;
try { try {
$widget->save(); $widget->save();
return redirect()->back()->with('success', $widget->name . Lang::get('lang.saved_successfully'));
return redirect()->back()->with('success', $widget->name.Lang::get('lang.saved_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
@@ -129,7 +133,8 @@ class SettingsController extends Controller {
* *
* @return response * @return response
*/ */
public function social_buttons() { public function social_buttons()
{
return view('themes.default1.admin.helpdesk.theme.social'); return view('themes.default1.admin.helpdesk.theme.social');
} }
@@ -138,7 +143,8 @@ class SettingsController extends Controller {
* *
* @return response * @return response
*/ */
public function list_social_buttons() { public function list_social_buttons()
{
return \Datatable::collection(Widgets::where('id', '>', '6')->get()) return \Datatable::collection(Widgets::where('id', '>', '6')->get())
->searchColumns('name') ->searchColumns('name')
->orderColumns('name', 'value') ->orderColumns('name', 'value')
@@ -149,25 +155,25 @@ class SettingsController extends Controller {
return $model->value; return $model->value;
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span> return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
<div class="modal fade" id="edit_widget' . $model->id . '"> <div class="modal fade" id="edit_widget'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="' . url('edit-widget/' . $model->id) . '" method="POST"> <form action="'.url('edit-widget/'.$model->id).'" method="POST">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4> <h4 class="modal-title">'.strtoupper($model->name).' </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<br/> <br/>
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>' . \Lang::get('lang.link') . '</label><br/> <label>'.\Lang::get('lang.link').'</label><br/>
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '"> <input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '"> <input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
</div> </div>
</form> </form>
</div> </div>
@@ -185,14 +191,15 @@ class SettingsController extends Controller {
* *
* @return type response * @return type response
*/ */
public function edit_social_buttons($id, Widgets $widgets, Request $request) { public function edit_social_buttons($id, Widgets $widgets, Request $request)
{
$widget = $widgets->where('id', '=', $id)->first(); $widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title; $widget->title = $request->title;
$widget->value = $request->content; $widget->value = $request->content;
try { try {
$widget->save(); $widget->save();
return redirect()->back()->with('success', $widget->name . ' Saved Successfully'); return redirect()->back()->with('success', $widget->name.' Saved Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
@@ -203,8 +210,10 @@ class SettingsController extends Controller {
* *
* @return type view * @return type view
*/ */
public function getsmtp() { public function getsmtp()
{
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings')); return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
} }
@@ -213,7 +222,8 @@ class SettingsController extends Controller {
* *
* @return type view * @return type view
*/ */
public function postsmtp(SmtpRequest $request) { public function postsmtp(SmtpRequest $request)
{
$data = Smtp::where('id', '=', 1)->first(); $data = Smtp::where('id', '=', 1)->first();
$data->driver = $request->input('driver'); $data->driver = $request->input('driver');
$data->host = $request->input('host'); $data->host = $request->input('host');
@@ -224,6 +234,7 @@ class SettingsController extends Controller {
$data->password = Crypt::encrypt($request->input('password')); $data->password = Crypt::encrypt($request->input('password'));
try { try {
$data->save(); $data->save();
return \Redirect::route('getsmtp')->with('success', 'success'); return \Redirect::route('getsmtp')->with('success', 'success');
} catch (Exception $e) { } catch (Exception $e) {
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]); return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
@@ -238,7 +249,8 @@ class SettingsController extends Controller {
* *
* @return type view * @return type view
*/ */
public function PostSettings(Settings $set, Request $request) { public function PostSettings(Settings $set, Request $request)
{
$settings = $set->where('id', '1')->first(); $settings = $set->where('id', '1')->first();
$pass = $request->input('password'); $pass = $request->input('password');
$password = Crypt::encrypt($pass); $password = Crypt::encrypt($pass);
@@ -251,7 +263,7 @@ class SettingsController extends Controller {
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist/logo'; $destinationPath = 'dist/logo';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName; $settings->logo = $fileName;
$settings->save(); $settings->save();
@@ -265,11 +277,13 @@ class SettingsController extends Controller {
} }
} }
public function Plugins() { public function Plugins()
{
return view('themes.default1.admin.helpdesk.settings.plugins'); return view('themes.default1.admin.helpdesk.settings.plugins');
} }
public function GetPlugin() { public function GetPlugin()
{
$plugins = $this->fetchConfig(); $plugins = $this->fetchConfig();
return \Datatable::collection(new Collection($plugins)) return \Datatable::collection(new Collection($plugins))
@@ -277,15 +291,15 @@ class SettingsController extends Controller {
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
if (array_has($model, 'path')) { if (array_has($model, 'path')) {
if ($model['status'] == 0) { if ($model['status'] == 0) {
$activate = '<a href=' . url('plugin/status/' . $model['path']) . '>Activate</a>'; $activate = '<a href='.url('plugin/status/'.$model['path']).'>Activate</a>';
$settings = ' '; $settings = ' ';
} else { } else {
$settings = '<a href=' . url($model['settings']) . '>Settings</a> | '; $settings = '<a href='.url($model['settings']).'>Settings</a> | ';
$activate = '<a href=' . url('plugin/status/' . $model['path']) . '>Deactivate</a>'; $activate = '<a href='.url('plugin/status/'.$model['path']).'>Deactivate</a>';
} }
$delete = '<a href="#" id=delete' . $model['path'] . ' data-toggle=modal data-target=#del' . $model['path'] . "><span style='color:red'>Delete</span></a>" $delete = '<a href="#" id=delete'.$model['path'].' data-toggle=modal data-target=#del'.$model['path']."><span style='color:red'>Delete</span></a>"
. "<div class='modal fade' id=del" . $model['path'] . "> ."<div class='modal fade' id=del".$model['path'].">
<div class='modal-dialog'> <div class='modal-dialog'>
<div class=modal-content> <div class=modal-content>
<div class=modal-header> <div class=modal-header>
@@ -294,8 +308,8 @@ class SettingsController extends Controller {
<div class=modal-body> <div class=modal-body>
<p>Are you Sure ?</p> <p>Are you Sure ?</p>
<div class=modal-footer> <div class=modal-footer>
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>" . \Lang::get('lang.close') . '</button> <button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>".\Lang::get('lang.close').'</button>
<a href=' . url('plugin/delete/' . $model['path']) . "><button class='btn btn-danger'>Delete</button></a> <a href='.url('plugin/delete/'.$model['path'])."><button class='btn btn-danger'>Delete</button></a>
</div> </div>
@@ -303,12 +317,12 @@ class SettingsController extends Controller {
</div> </div>
</div> </div>
</div>"; </div>";
$action = '<br><br>' . $delete . ' | ' . $settings . $activate; $action = '<br><br>'.$delete.' | '.$settings.$activate;
} else { } else {
$action = ''; $action = '';
} }
return ucfirst($model['name']) . $action; return ucfirst($model['name']).$action;
}) })
->addColumn('description', function ($model) { ->addColumn('description', function ($model) {
return ucfirst($model['description']); return ucfirst($model['description']);
@@ -317,7 +331,7 @@ class SettingsController extends Controller {
return ucfirst($model['author']); return ucfirst($model['author']);
}) })
->addColumn('website', function ($model) { ->addColumn('website', function ($model) {
return '<a href=' . $model['website'] . ' target=_blank>' . $model['website'] . '</a>'; return '<a href='.$model['website'].' target=_blank>'.$model['website'].'</a>';
}) })
->addColumn('version', function ($model) { ->addColumn('version', function ($model) {
return $model['version']; return $model['version'];
@@ -330,8 +344,9 @@ class SettingsController extends Controller {
* *
* @return type * @return type
*/ */
public function ReadPlugins() { public function ReadPlugins()
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins'; {
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins';
$plugins = array_diff(scandir($dir), ['.', '..']); $plugins = array_diff(scandir($dir), ['.', '..']);
return $plugins; return $plugins;
@@ -344,15 +359,16 @@ class SettingsController extends Controller {
* *
* @return type * @return type
*/ */
public function PostPlugins(Request $request) { public function PostPlugins(Request $request)
{
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']); $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
try { try {
if (!extension_loaded('zip')){ if (!extension_loaded('zip')) {
throw new Exception('Please enable zip extension in your php'); throw new Exception('Please enable zip extension in your php');
} }
$plug = new Plugin(); $plug = new Plugin();
$file = $request->file('plugin'); $file = $request->file('plugin');
$destination = app_path() . DIRECTORY_SEPARATOR . 'Plugins'; $destination = app_path().DIRECTORY_SEPARATOR.'Plugins';
$zipfile = $file->getRealPath(); $zipfile = $file->getRealPath();
/* /*
* get the file name and remove .zip * get the file name and remove .zip
@@ -365,31 +381,31 @@ class SettingsController extends Controller {
if (in_array($filename, $dir_check)) { if (in_array($filename, $dir_check)) {
return redirect()->back()->with('fails', Lang::get('lang.plugin-exists')); return redirect()->back()->with('fails', Lang::get('lang.plugin-exists'));
} }
mkdir($destination . DIRECTORY_SEPARATOR . $filename); mkdir($destination.DIRECTORY_SEPARATOR.$filename);
/* /*
* extract the zip file using zipper * extract the zip file using zipper
*/ */
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . DIRECTORY_SEPARATOR . $filename); \Zipper::make($zipfile)->folder($filename2)->extractTo($destination.DIRECTORY_SEPARATOR.$filename);
$file = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $filename; // Plugin file path $file = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$filename; // Plugin file path
if (file_exists($file)) { if (file_exists($file)) {
$seviceporvider = $file . DIRECTORY_SEPARATOR . 'ServiceProvider.php'; $seviceporvider = $file.DIRECTORY_SEPARATOR.'ServiceProvider.php';
$config = $file . DIRECTORY_SEPARATOR . 'config.php'; $config = $file.DIRECTORY_SEPARATOR.'config.php';
if (file_exists($seviceporvider) && file_exists($config)) { if (file_exists($seviceporvider) && file_exists($config)) {
/* /*
* move to faveo config * move to faveo config
*/ */
$faveoconfig = config_path() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $filename . '.php'; $faveoconfig = config_path().DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$filename.'.php';
if ($faveoconfig) { if ($faveoconfig) {
//copy($config, $faveoconfig); //copy($config, $faveoconfig);
/* /*
* write provider list in app.php line 128 * write provider list in app.php line 128
*/ */
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php'; $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
chmod($app, 0644); chmod($app, 0644);
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',"; $str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
@@ -403,7 +419,7 @@ class SettingsController extends Controller {
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', Lang::get('no-plugin-file') . $file); return redirect()->back()->with('fails', Lang::get('no-plugin-file').$file);
} }
} else { } else {
/* /*
@@ -411,7 +427,7 @@ class SettingsController extends Controller {
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', Lang::get('plugin-config-missing') . $file); return redirect()->back()->with('fails', Lang::get('plugin-config-missing').$file);
} }
} else { } else {
/* /*
@@ -419,7 +435,7 @@ class SettingsController extends Controller {
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', '<b>' . Lang::get('lang.plugin-path-missing') . '</b> ' . $file); return redirect()->back()->with('fails', '<b>'.Lang::get('lang.plugin-path-missing').'</b> '.$file);
} }
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
@@ -433,7 +449,8 @@ class SettingsController extends Controller {
* *
* @return bool * @return bool
*/ */
public function deleteDirectory($dir) { public function deleteDirectory($dir)
{
if (!file_exists($dir)) { if (!file_exists($dir)) {
return true; return true;
} }
@@ -444,8 +461,8 @@ class SettingsController extends Controller {
if ($item == '.' || $item == '..') { if ($item == '.' || $item == '..') {
continue; continue;
} }
chmod($dir . DIRECTORY_SEPARATOR . $item, 0777); chmod($dir.DIRECTORY_SEPARATOR.$item, 0777);
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) { if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) {
return false; return false;
} }
} }
@@ -454,8 +471,9 @@ class SettingsController extends Controller {
return rmdir($dir); return rmdir($dir);
} }
public function ReadConfigs() { public function ReadConfigs()
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR; {
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR;
$directories = scandir($dir); $directories = scandir($dir);
$files = []; $files = [];
foreach ($directories as $key => $file) { foreach ($directories as $key => $file) {
@@ -463,7 +481,7 @@ class SettingsController extends Controller {
continue; continue;
} }
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) { if (is_dir($dir.DIRECTORY_SEPARATOR.$file)) {
$files[$key] = $file; $files[$key] = $file;
} }
} }
@@ -472,7 +490,7 @@ class SettingsController extends Controller {
$plugins = []; $plugins = [];
if (count($files) > 0) { if (count($files) > 0) {
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
$plugin = $dir . $file; $plugin = $dir.$file;
$plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']); $plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
$plugins[$key]['file'] = $plugin; $plugins[$key]['file'] = $plugin;
} }
@@ -482,7 +500,7 @@ class SettingsController extends Controller {
if ($dh = opendir($dir)) { if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {
if ($file == 'config.php') { if ($file == 'config.php') {
$config[] = $dir . DIRECTORY_SEPARATOR . $file; $config[] = $dir.DIRECTORY_SEPARATOR.$file;
} }
} }
closedir($dh); closedir($dh);
@@ -495,7 +513,8 @@ class SettingsController extends Controller {
} }
} }
public function fetchConfig() { public function fetchConfig()
{
$configs = $this->ReadConfigs(); $configs = $this->ReadConfigs();
//dd($configs); //dd($configs);
$plugs = new Plugin(); $plugs = new Plugin();
@@ -531,14 +550,15 @@ class SettingsController extends Controller {
return $attributes; return $attributes;
} }
public function DeletePlugin($slug) { public function DeletePlugin($slug)
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $slug; {
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$slug;
$this->deleteDirectory($dir); $this->deleteDirectory($dir);
/* /*
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php'; $path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, '//', $file_contents); $file_contents = str_replace($str, '//', $file_contents);
file_put_contents($path_to_file, $file_contents); file_put_contents($path_to_file, $file_contents);
@@ -551,12 +571,13 @@ class SettingsController extends Controller {
return redirect()->back()->with('success', 'Deleted Successfully'); return redirect()->back()->with('success', 'Deleted Successfully');
} }
public function StatusPlugin($slug) { public function StatusPlugin($slug)
{
$plugs = new Plugin(); $plugs = new Plugin();
$plug = $plugs->where('name', $slug)->first(); $plug = $plugs->where('name', $slug)->first();
if (!$plug) { if (!$plug) {
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php'; $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
@@ -569,8 +590,8 @@ class SettingsController extends Controller {
if ($status == 0) { if ($status == 0) {
$plug->status = 1; $plug->status = 1;
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php'; $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
@@ -581,8 +602,8 @@ class SettingsController extends Controller {
/* /*
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php'; $path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, '//', $file_contents); $file_contents = str_replace($str, '//', $file_contents);

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\Http\Controllers\Controller;
class HomeController extends Controller class HomeController extends Controller
{ {

View File

@@ -9,16 +9,18 @@ use Artisan;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class UpgradeController extends Controller { class UpgradeController extends Controller
{
public $dir; public $dir;
public function __construct() { public function __construct()
{
$dir = base_path(); $dir = base_path();
$this->dir = $dir; $this->dir = $dir;
} }
public function getLatestVersion() { public function getLatestVersion()
{
try { try {
$name = \Config::get('app.name'); $name = \Config::get('app.name');
//dd($name); //dd($name);
@@ -28,17 +30,17 @@ class UpgradeController extends Controller {
$order_number = '44596328'; $order_number = '44596328';
$url = env('APP_URL'); $url = env('APP_URL');
$data = [ $data = [
'serial_key' => $serial_key, 'serial_key' => $serial_key,
'order_number' => $order_number, 'order_number' => $order_number,
'name' => $name, 'name' => $name,
'version' => Utility::getFileVersion(), 'version' => Utility::getFileVersion(),
'request_type' => 'check_update', 'request_type' => 'check_update',
'url' => $url, 'url' => $url,
]; ];
$data = Utility::encryptByFaveoPublicKey(json_encode($data)); $data = Utility::encryptByFaveoPublicKey(json_encode($data));
//dd($data); //dd($data);
$post_data = [ $post_data = [
'data' => $data 'data' => $data,
]; ];
$url = 'http://faveohelpdesk.com/billing/public/verification'; $url = 'http://faveohelpdesk.com/billing/public/verification';
if (str_contains($url, ' ')) { if (str_contains($url, ' ')) {
@@ -59,7 +61,8 @@ class UpgradeController extends Controller {
} }
} }
public function downloadLatestCode() { public function downloadLatestCode()
{
$name = \Config::get('app.name'); $name = \Config::get('app.name');
$durl = 'http://www.faveohelpdesk.com/billing/public/download-url'; $durl = 'http://www.faveohelpdesk.com/billing/public/download-url';
if (str_contains($durl, ' ')) { if (str_contains($durl, ' ')) {
@@ -75,7 +78,8 @@ class UpgradeController extends Controller {
return $download_url; return $download_url;
} }
public function saveLatestCodeAtTemp($download_url) { public function saveLatestCodeAtTemp($download_url)
{
echo '<p>Downloading New Update</p>'; echo '<p>Downloading New Update</p>';
$context = stream_context_create( $context = stream_context_create(
[ [
@@ -87,10 +91,10 @@ class UpgradeController extends Controller {
$newUpdate = file_get_contents($download_url, false, $context); $newUpdate = file_get_contents($download_url, false, $context);
if (!is_dir("$this->dir/UPDATES/")) { if (!is_dir("$this->dir/UPDATES/")) {
\File::makeDirectory($this->dir . '/UPDATES/', 0777); \File::makeDirectory($this->dir.'/UPDATES/', 0777);
} }
$dlHandler = fopen($this->dir . '/UPDATES/' . '/faveo-helpdesk-master.zip', 'w'); $dlHandler = fopen($this->dir.'/UPDATES/'.'/faveo-helpdesk-master.zip', 'w');
if (!fwrite($dlHandler, $newUpdate)) { if (!fwrite($dlHandler, $newUpdate)) {
echo '<p>Could not save new update. Operation aborted.</p>'; echo '<p>Could not save new update. Operation aborted.</p>';
exit(); exit();
@@ -99,25 +103,28 @@ class UpgradeController extends Controller {
echo '<p>Update Downloaded And Saved</p>'; echo '<p>Update Downloaded And Saved</p>';
} }
public function doUpdate() { public function doUpdate()
{
try { try {
$memory_limit = ini_get('memory_limit'); $memory_limit = ini_get('memory_limit');
if ($memory_limit < 256) { if ($memory_limit < 256) {
echo '<ul class=list-unstyled>'; echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>Sorry we can not process your request because of limited memory! You have only $memory_limit. For this you need atleast 256 MB</li>"; echo "<li style='color:red;'>Sorry we can not process your request because of limited memory! You have only $memory_limit. For this you need atleast 256 MB</li>";
echo '</ul>'; echo '</ul>';
return 0; return 0;
} }
if (!extension_loaded('zip')) { if (!extension_loaded('zip')) {
echo '<ul class=list-unstyled>'; echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>Sorry we can not process your request because you don't have ZIP extension contact your system admin</li>"; echo "<li style='color:red;'>Sorry we can not process your request because you don't have ZIP extension contact your system admin</li>";
echo '</ul>'; echo '</ul>';
return 0; return 0;
} }
//Artisan::call('down'); //Artisan::call('down');
$update = $this->dir . '/UPDATES'; $update = $this->dir.'/UPDATES';
//Open The File And Do Stuff //Open The File And Do Stuff
$zipHandle = zip_open($update . '/faveo-helpdesk-master.zip'); $zipHandle = zip_open($update.'/faveo-helpdesk-master.zip');
//dd($update . '/faveo-' . $aV . '.zip'); //dd($update . '/faveo-' . $aV . '.zip');
echo '<ul class=list-unstyled>'; echo '<ul class=list-unstyled>';
@@ -132,28 +139,28 @@ class UpgradeController extends Controller {
//Make the directory if we need to... //Make the directory if we need to...
if (!is_dir($update . '/' . $thisFileDir . '/')) { if (!is_dir($update.'/'.$thisFileDir.'/')) {
\File::makeDirectory($update . '/' . $thisFileDir, 0775, true, true); \File::makeDirectory($update.'/'.$thisFileDir, 0775, true, true);
// mkdir($update.'/'. $thisFileDir, 0775); // mkdir($update.'/'. $thisFileDir, 0775);
echo '<li style="color:white;">Created Directory ' . $thisFileDir . '</li>'; echo '<li style="color:white;">Created Directory '.$thisFileDir.'</li>';
} }
//Overwrite the file //Overwrite the file
if (!is_dir($update . '/' . $thisFileName)) { if (!is_dir($update.'/'.$thisFileName)) {
echo '<li style="color:white;">' . $thisFileName . '...........'; echo '<li style="color:white;">'.$thisFileName.'...........';
$contents = zip_entry_read($aF, zip_entry_filesize($aF)); $contents = zip_entry_read($aF, zip_entry_filesize($aF));
$contents = str_replace("\r\n", "\n", $contents); $contents = str_replace("\r\n", "\n", $contents);
$updateThis = ''; $updateThis = '';
//If we need to run commands, then do it. //If we need to run commands, then do it.
if ($thisFileName == $thisFileDir . '/.env') { if ($thisFileName == $thisFileDir.'/.env') {
if (is_file($update . '/' . $thisFileDir . '/.env')) { if (is_file($update.'/'.$thisFileDir.'/.env')) {
unlink($update . '/' . $thisFileDir . '/.env'); unlink($update.'/'.$thisFileDir.'/.env');
unlink($update . '/' . $thisFileDir . '/config/database.php'); unlink($update.'/'.$thisFileDir.'/config/database.php');
} }
echo' EXECUTED</li>'; echo' EXECUTED</li>';
} else { } else {
$updateThis = fopen($update . '/' . $thisFileName, 'w'); $updateThis = fopen($update.'/'.$thisFileName, 'w');
fwrite($updateThis, $contents); fwrite($updateThis, $contents);
fclose($updateThis); fclose($updateThis);
unset($contents); unset($contents);
@@ -166,12 +173,13 @@ class UpgradeController extends Controller {
return true; return true;
} catch (Exception $ex) { } catch (Exception $ex) {
echo '<ul class=list-unstyled>'; echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>"; echo "<li style='color:red;'>".$ex->getMessage().'</li>';
echo '</ul>'; echo '</ul>';
} }
} }
public function copyToActualDirectory($latest_version) { public function copyToActualDirectory($latest_version)
{
try { try {
echo '<ul class=list-unstyled>'; echo '<ul class=list-unstyled>';
$directory = "$this->dir/UPDATES"; $directory = "$this->dir/UPDATES";
@@ -190,17 +198,18 @@ class UpgradeController extends Controller {
$this->deleteBarNotification('new-version'); $this->deleteBarNotification('new-version');
echo "<li style='color:green;'>&raquo; Faveo Updated to v" . Utility::getFileVersion() . "</li>"; echo "<li style='color:green;'>&raquo; Faveo Updated to v".Utility::getFileVersion().'</li>';
echo '</ul>'; echo '</ul>';
} catch (Exception $ex) { } catch (Exception $ex) {
echo '<ul class=list-unstyled>'; echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>"; echo "<li style='color:red;'>".$ex->getMessage().'</li>';
echo '</ul>'; echo '</ul>';
} }
exit(); exit();
} }
public function deleteBarNotification($key) { public function deleteBarNotification($key)
{
try { try {
$noti = new BarNotification(); $noti = new BarNotification();
$notifications = $noti->where('key', $key)->get(); $notifications = $noti->where('key', $key)->get();
@@ -212,20 +221,24 @@ class UpgradeController extends Controller {
} }
} }
public function fileUpdate() { public function fileUpdate()
{
try { try {
$latest_version = $this->getLatestVersion(); $latest_version = $this->getLatestVersion();
if (Utility::getFileVersion() < $latest_version) { if (Utility::getFileVersion() < $latest_version) {
$url = url('file-upgrade'); $url = url('file-upgrade');
return view('themes.default1.update.file', compact('url')); return view('themes.default1.update.file', compact('url'));
} }
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.'); return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
public function fileUpgrading(Request $request) { public function fileUpgrading(Request $request)
{
try { try {
// //
$latest_version = $this->getLatestVersion(); $latest_version = $this->getLatestVersion();
@@ -233,10 +246,10 @@ class UpgradeController extends Controller {
$current_version = Utility::getFileVersion(); $current_version = Utility::getFileVersion();
if ($latest_version != '') { if ($latest_version != '') {
if (Utility::getFileVersion() < $latest_version) { if (Utility::getFileVersion() < $latest_version) {
return view('themes.default1.update.update', compact('latest_version', 'current_version', 'request')); return view('themes.default1.update.update', compact('latest_version', 'current_version', 'request'));
} }
} }
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.'); return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
@@ -248,7 +261,8 @@ class UpgradeController extends Controller {
} }
} }
public function testScroll() { public function testScroll()
{
$ex = 1000; $ex = 1000;
echo '<ul style=list-unstyled>'; echo '<ul style=list-unstyled>';
for ($i = 0; $i < $ex; $i++) { for ($i = 0; $i < $ex; $i++) {
@@ -257,7 +271,8 @@ class UpgradeController extends Controller {
echo '</ul>'; echo '</ul>';
} }
public function fileUpgrading1(Request $request) { public function fileUpgrading1(Request $request)
{
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) { if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
$latest_version = $this->getLatestVersion(); $latest_version = $this->getLatestVersion();
// dd($latest_version); // dd($latest_version);
@@ -267,7 +282,7 @@ class UpgradeController extends Controller {
echo "<p>CURRENT VERSION: $current_version</p>"; echo "<p>CURRENT VERSION: $current_version</p>";
echo '<p>Reading Current Releases List</p>'; echo '<p>Reading Current Releases List</p>';
if ($latest_version > $current_version) { if ($latest_version > $current_version) {
echo '<p>New Update Found: v' . $latest_version . '</p>'; echo '<p>New Update Found: v'.$latest_version.'</p>';
$found = true; $found = true;
if (!is_file("$this->dir/UPDATES/faveo-helpdesk-master.zip")) { if (!is_file("$this->dir/UPDATES/faveo-helpdesk-master.zip")) {
if ($request->get('dodownload') == true) { if ($request->get('dodownload') == true) {
@@ -278,7 +293,7 @@ class UpgradeController extends Controller {
echo '<p>Error in you network connection.</p>'; echo '<p>Error in you network connection.</p>';
} }
} else { } else {
echo '<p>Latest code found. <a href=' . url('file-upgrade?dodownload=true') . '>&raquo; Download Now?</a></p>'; echo '<p>Latest code found. <a href='.url('file-upgrade?dodownload=true').'>&raquo; Download Now?</a></p>';
exit(); exit();
} }
} else { } else {
@@ -287,7 +302,7 @@ class UpgradeController extends Controller {
if ($request->get('doUpdate') == true) { if ($request->get('doUpdate') == true) {
$updated = $this->doUpdate(); $updated = $this->doUpdate();
} else { } else {
echo '<p>Update ready. <a href=' . url('file-upgrade?doUpdate=true') . '>&raquo; Install Now?</a></p>'; echo '<p>Update ready. <a href='.url('file-upgrade?doUpdate=true').'>&raquo; Install Now?</a></p>';
exit(); exit();
} }
@@ -307,17 +322,18 @@ class UpgradeController extends Controller {
} }
} }
public function getCurl($url) { public function getCurl($url)
{
try { try {
$curl = Utility::_isCurl(); $curl = Utility::_isCurl();
if (!$curl) { if (!$curl) {
throw new Exception("Please enable your curl function to check latest update"); throw new Exception('Please enable your curl function to check latest update');
} }
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
if (curl_exec($ch) === false) { if (curl_exec($ch) === false) {
echo 'Curl error: ' . curl_error($ch); echo 'Curl error: '.curl_error($ch);
} }
$data = curl_exec($ch); $data = curl_exec($ch);
curl_close($ch); curl_close($ch);
@@ -328,11 +344,12 @@ class UpgradeController extends Controller {
} }
} }
public function postDownloadCurl($url, $data) { public function postDownloadCurl($url, $data)
{
try { try {
$curl = Utility::_isCurl(); $curl = Utility::_isCurl();
if (!$curl) { if (!$curl) {
throw new Exception("Please enable your curl function to check latest update"); throw new Exception('Please enable your curl function to check latest update');
} }
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
@@ -340,21 +357,23 @@ class UpgradeController extends Controller {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
if (curl_exec($ch) === false) { if (curl_exec($ch) === false) {
echo 'Curl error: ' . curl_error($ch); echo 'Curl error: '.curl_error($ch);
} }
$data = curl_exec($ch); $data = curl_exec($ch);
curl_close($ch); curl_close($ch);
return json_decode($data, true); return json_decode($data, true);
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
public function postCurl($url, $data) { public function postCurl($url, $data)
{
try { try {
$curl = Utility::_isCurl(); $curl = Utility::_isCurl();
if (!$curl) { if (!$curl) {
throw new Exception("Please enable your curl function to check latest update"); throw new Exception('Please enable your curl function to check latest update');
} }
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
@@ -362,18 +381,20 @@ class UpgradeController extends Controller {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
if (curl_exec($ch) === false) { if (curl_exec($ch) === false) {
echo 'Curl error: ' . curl_error($ch); echo 'Curl error: '.curl_error($ch);
} }
$data = curl_exec($ch); $data = curl_exec($ch);
curl_close($ch); curl_close($ch);
$data = Utility::decryptByFaveoPrivateKey($data); $data = Utility::decryptByFaveoPrivateKey($data);
return json_decode($data, true); return json_decode($data, true);
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
public function databaseUpdate() { public function databaseUpdate()
{
try { try {
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) { if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
$url = url('database-upgrade'); $url = url('database-upgrade');
@@ -387,7 +408,8 @@ class UpgradeController extends Controller {
} }
} }
public function databaseUpgrade() { public function databaseUpgrade()
{
try { try {
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) { if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
@@ -400,5 +422,4 @@ class UpgradeController extends Controller {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
} }

View File

@@ -7,9 +7,10 @@ use Config;
use Exception; use Exception;
use Schema; use Schema;
class LibraryController extends Controller { class LibraryController extends Controller
{
public static function getFileVersion() { public static function getFileVersion()
{
try { try {
$app = Config::get('app.version'); $app = Config::get('app.version');
if ($app) { if ($app) {
@@ -22,7 +23,8 @@ class LibraryController extends Controller {
} }
} }
public static function getDatabaseVersion() { public static function getDatabaseVersion()
{
try { try {
$database = self::isDatabaseSetup(); $database = self::isDatabaseSetup();
if ($database == true) { if ($database == true) {
@@ -39,7 +41,8 @@ class LibraryController extends Controller {
} }
} }
public static function isDatabaseSetup() { public static function isDatabaseSetup()
{
try { try {
if (Schema::hasTable('settings_system')) { if (Schema::hasTable('settings_system')) {
return true; return true;
@@ -49,47 +52,50 @@ class LibraryController extends Controller {
} }
} }
public static function encryptByFaveoPublicKey($data) { public static function encryptByFaveoPublicKey($data)
{
try { try {
$path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key'; $path = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public.key';
//dd($path); //dd($path);
$key_content = file_get_contents($path); $key_content = file_get_contents($path);
$public_key = openssl_get_publickey($key_content); $public_key = openssl_get_publickey($key_content);
$encrypted = $e = NULL; $encrypted = $e = null;
openssl_seal($data, $encrypted, $e, array($public_key)); openssl_seal($data, $encrypted, $e, [$public_key]);
$sealed_data = base64_encode($encrypted); $sealed_data = base64_encode($encrypted);
$envelope = base64_encode($e[0]); $envelope = base64_encode($e[0]);
$result = ['seal' => $sealed_data, 'envelope' => $envelope]; $result = ['seal' => $sealed_data, 'envelope' => $envelope];
return json_encode($result); return json_encode($result);
} catch (Exception $ex) { } catch (Exception $ex) {
throw new Exception($ex->getMessage()); throw new Exception($ex->getMessage());
} }
} }
public static function decryptByFaveoPrivateKey($encrypted) { public static function decryptByFaveoPrivateKey($encrypted)
{
try { try {
$encrypted = json_decode($encrypted); $encrypted = json_decode($encrypted);
$sealed_data = $encrypted->seal; $sealed_data = $encrypted->seal;
$envelope = $encrypted->envelope; $envelope = $encrypted->envelope;
$input = base64_decode($sealed_data); $input = base64_decode($sealed_data);
$einput = base64_decode($envelope); $einput = base64_decode($envelope);
$path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key'); $path = storage_path('app'.DIRECTORY_SEPARATOR.'private.key');
$key_content = file_get_contents($path); $key_content = file_get_contents($path);
$private_key = openssl_get_privatekey($key_content); $private_key = openssl_get_privatekey($key_content);
$plaintext = NULL; $plaintext = null;
openssl_open($input, $plaintext, $einput, $private_key); openssl_open($input, $plaintext, $einput, $private_key);
return $plaintext; return $plaintext;
} catch (Exception $ex) { } catch (Exception $ex) {
// dd($ex); // dd($ex);
} }
} }
public static function _isCurl() { public static function _isCurl()
{
return function_exists('curl_version'); return function_exists('curl_version');
} }
} }

View File

@@ -30,9 +30,9 @@ class CreateTicketRequest extends Request
{ {
return [ return [
'email' => 'required|email|max:60', 'email' => 'required|email|max:60',
'first_name' => 'required|min:3|max:40', 'first_name' => 'required|min:3|max:40',
'helptopic' => 'required', 'helptopic' => 'required',
// 'dept' => 'required', // 'dept' => 'required',
'sla' => 'required', 'sla' => 'required',
'subject' => 'required|min:5', 'subject' => 'required|min:5',

View File

@@ -29,9 +29,9 @@ class Sys_userRequest extends Request
public function rules() public function rules()
{ {
return [ return [
'first_name' => 'required', 'first_name' => 'required',
'user_name' => 'required|min:3|unique:users,user_name', 'user_name' => 'required|min:3|unique:users,user_name',
'email' => 'required|unique:users,email', 'email' => 'required|unique:users,email',
]; ];
} }
} }

View File

@@ -3,6 +3,7 @@
namespace App\Http\Requests\helpdesk; namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
//use Illuminate\Http\Request as Req; //use Illuminate\Http\Request as Req;
/** /**
* Sys_userUpdate. * Sys_userUpdate.
@@ -29,9 +30,9 @@ class Sys_userUpdate extends Request
public function rules() public function rules()
{ {
return [ return [
'first_name' => 'required', 'first_name' => 'required',
'user_name' => 'required|min:3|unique:users,user_name,'.$this->segment(2), 'user_name' => 'required|min:3|unique:users,user_name,'.$this->segment(2),
'email' => 'required|email|unique:users,email,'.$this->segment(2), 'email' => 'required|email|unique:users,email,'.$this->segment(2),
]; ];
} }
} }

View File

@@ -9,14 +9,15 @@ use App\Http\Requests\Request;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class TicketRequest extends Request { class TicketRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -25,39 +26,42 @@ class TicketRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
$error = ""; {
$error = '';
try { try {
$size = $this->size(); $size = $this->size();
if ($size > 800 || $size==0) { if ($size > 800 || $size == 0) {
throw new \Exception("File size exceeded", 422); throw new \Exception('File size exceeded', 422);
} }
} catch (\Exception $ex) { } catch (\Exception $ex) {
dd($ex); dd($ex);
$error = $this->error($ex); $error = $this->error($ex);
} }
// return [ // return [
// 'attachment' => 'not_in:'.$error, // 'attachment' => 'not_in:'.$error,
// ]; // ];
} }
public function size() { public function size()
{
$files = $this->file('attachment'); $files = $this->file('attachment');
if (!$files) { if (!$files) {
throw new \Exception("exceeded", 422); throw new \Exception('exceeded', 422);
} }
$size = 0; $size = 0;
if (count($files) > 0) { if (count($files) > 0) {
foreach ($files as $file) { foreach ($files as $file) {
$size +=$file->getSize(); $size += $file->getSize();
} }
} }
return $size; return $size;
} }
public function error($e) { public function error($e)
{
if ($this->ajax() || $this->wantsJson()) { if ($this->ajax() || $this->wantsJson()) {
$message = $e->getMessage(); $message = $e->getMessage();
if (is_object($message)) { if (is_object($message)) {
$message = $message->toArray(); $message = $message->toArray();
@@ -66,5 +70,4 @@ class TicketRequest extends Request {
return $message; return $message;
} }
} }
} }

View File

@@ -24,6 +24,7 @@ class CategoryRequest extends Request
public function rules() public function rules()
{ {
$id = $this->segment(2); $id = $this->segment(2);
return [ return [
'name' => 'required|max:250|unique:kb_category,name,'.$id, 'name' => 'required|max:250|unique:kb_category,name,'.$id,
'description' => 'required', 'description' => 'required',

View File

@@ -24,8 +24,9 @@ class PageRequest extends Request
public function rules() public function rules()
{ {
$slug = $this->segment(2); $slug = $this->segment(2);
return [ return [
'name' => 'required|unique:kb_pages,slug,'.$slug 'name' => 'required|unique:kb_pages,slug,'.$slug,
]; ];
} }
} }

View File

@@ -192,13 +192,13 @@ Route::group(['middleware' => ['web']], function () {
$breadcrumbs->push(Lang::get('lang.edit'), url('sla/{sla}/edit')); $breadcrumbs->push(Lang::get('lang.edit'), url('sla/{sla}/edit'));
}); });
Route::resource('forms', 'Admin\helpdesk\FormController'); Route::resource('forms', 'Admin\helpdesk\FormController');
Route::post('forms/field/{fieldid}/child',[ Route::post('forms/field/{fieldid}/child', [
'as'=>'forms.field.child', 'as' => 'forms.field.child',
'uses'=>'Admin\helpdesk\FormController@addChild', 'uses' => 'Admin\helpdesk\FormController@addChild',
]); ]);
Route::get('forms/render/child',[ Route::get('forms/render/child', [
'as'=>'forms.field.child', 'as' => 'forms.field.child',
'uses'=>'Admin\helpdesk\FormController@renderChild', 'uses' => 'Admin\helpdesk\FormController@renderChild',
]); ]);
Breadcrumbs::register('forms.index', function ($breadcrumbs) { Breadcrumbs::register('forms.index', function ($breadcrumbs) {
$breadcrumbs->parent('setting'); $breadcrumbs->parent('setting');
@@ -526,59 +526,59 @@ Route::group(['middleware' => ['web']], function () {
Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */ Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */
Breadcrumbs::register('inbox.ticket', function ($breadcrumbs) { Breadcrumbs::register('inbox.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.inbox'), route('inbox.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.inbox'), route('inbox.ticket'));
}); });
Route::get('/ticket/get-inbox', ['as' => 'get.inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); /* Get tickets in datatable */ Route::get('/ticket/get-inbox', ['as' => 'get.inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); /* Get tickets in datatable */
Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */ Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */
Breadcrumbs::register('open.ticket', function ($breadcrumbs) { Breadcrumbs::register('open.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.open'), route('open.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.open'), route('open.ticket'));
}); });
Route::get('/ticket/get-open', ['as' => 'get.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_open']); /* Get tickets in datatable */ Route::get('/ticket/get-open', ['as' => 'get.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_open']); /* Get tickets in datatable */
Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */ Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */
Breadcrumbs::register('answered.ticket', function ($breadcrumbs) { Breadcrumbs::register('answered.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.answered'), route('answered.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.answered'), route('answered.ticket'));
}); });
Route::get('/ticket/get-answered', ['as' => 'get.answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_answered']); /* Get tickets in datatable */ Route::get('/ticket/get-answered', ['as' => 'get.answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_answered']); /* Get tickets in datatable */
Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */ Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */
Breadcrumbs::register('myticket.ticket', function ($breadcrumbs) { Breadcrumbs::register('myticket.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.my_tickets'), route('myticket.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.my_tickets'), route('myticket.ticket'));
}); });
Route::get('/ticket/get-myticket', ['as' => 'get.myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_myticket']); /* Get tickets in datatable */ Route::get('/ticket/get-myticket', ['as' => 'get.myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_myticket']); /* Get tickets in datatable */
Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */ Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */
Breadcrumbs::register('overdue.ticket', function ($breadcrumbs) { Breadcrumbs::register('overdue.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.overdue'), route('overdue.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.overdue'), route('overdue.ticket'));
}); });
Route::get('/ticket/get-overdue', ['as' => 'get.overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@getOverdueTickets']); /* Get Overdue Ticket */ Route::get('/ticket/get-overdue', ['as' => 'get.overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@getOverdueTickets']); /* Get Overdue Ticket */
Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */ Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */
Breadcrumbs::register('closed.ticket', function ($breadcrumbs) { Breadcrumbs::register('closed.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.closed'), route('closed.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.closed'), route('closed.ticket'));
}); });
Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */ Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */
Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */ Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */
Breadcrumbs::register('assigned.ticket', function ($breadcrumbs) { Breadcrumbs::register('assigned.ticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.assigned'), route('assigned.ticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.assigned'), route('assigned.ticket'));
}); });
Route::get('/ticket/get-assigned', ['as' => 'get.assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_assigned']); /* Get tickets in datatable */ Route::get('/ticket/get-assigned', ['as' => 'get.assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_assigned']); /* Get tickets in datatable */
Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */ Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */
Breadcrumbs::register('newticket', function ($breadcrumbs) { Breadcrumbs::register('newticket', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.create'), route('newticket')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.create'), route('newticket'));
}); });
Route::get('/newticket/autofill', ['as' => 'post.newticket.autofill', 'uses' => 'Agent\helpdesk\TicketController@autofill']); Route::get('/newticket/autofill', ['as' => 'post.newticket.autofill', 'uses' => 'Agent\helpdesk\TicketController@autofill']);
Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\helpdesk\TicketController@post_newticket']); /* Post Create New Ticket */ Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\helpdesk\TicketController@post_newticket']); /* Post Create New Ticket */
Route::get('/thread/{id}', ['as' => 'ticket.thread', 'uses' => 'Agent\helpdesk\TicketController@thread']); /* Get Thread by ID */ Route::get('/thread/{id}', ['as' => 'ticket.thread', 'uses' => 'Agent\helpdesk\TicketController@thread']); /* Get Thread by ID */
Breadcrumbs::register('ticket.thread', function ($breadcrumbs, $id) { Breadcrumbs::register('ticket.thread', function ($breadcrumbs, $id) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$ticket_number = App\Model\helpdesk\Ticket\Tickets::where('id', '=', $id)->first(); $ticket_number = App\Model\helpdesk\Ticket\Tickets::where('id', '=', $id)->first();
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . $ticket_number->ticket_number, url('/thread/{id}')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.$ticket_number->ticket_number, url('/thread/{id}'));
}); });
Route::post('/thread/reply/{id}', ['as' => 'ticket.reply', 'uses' => 'Agent\helpdesk\TicketController@reply']); /* Patch Thread Reply */ Route::post('/thread/reply/{id}', ['as' => 'ticket.reply', 'uses' => 'Agent\helpdesk\TicketController@reply']); /* Patch Thread Reply */
Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\helpdesk\TicketController@InternalNote']); /* Patch Internal Note */ Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\helpdesk\TicketController@InternalNote']); /* Patch Internal Note */
@@ -595,13 +595,13 @@ Route::group(['middleware' => ['web']], function () {
Route::get('trash', ['as' => 'get-trash', 'uses' => 'Agent\helpdesk\TicketController@trash']); /* To show Deleted Tickets */ Route::get('trash', ['as' => 'get-trash', 'uses' => 'Agent\helpdesk\TicketController@trash']); /* To show Deleted Tickets */
Breadcrumbs::register('get-trash', function ($breadcrumbs) { Breadcrumbs::register('get-trash', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.trash'), route('get-trash')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.trash'), route('get-trash'));
}); });
Route::get('/ticket/trash', ['as' => 'get.trash.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_trash']); /* Get tickets in datatable */ Route::get('/ticket/trash', ['as' => 'get.trash.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_trash']); /* Get tickets in datatable */
Route::get('unassigned', ['as' => 'unassigned', 'uses' => 'Agent\helpdesk\TicketController@unassigned']); /* To show Unassigned Tickets */ Route::get('unassigned', ['as' => 'unassigned', 'uses' => 'Agent\helpdesk\TicketController@unassigned']); /* To show Unassigned Tickets */
Breadcrumbs::register('unassigned', function ($breadcrumbs) { Breadcrumbs::register('unassigned', function ($breadcrumbs) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.tickets') . '&nbsp; > &nbsp;' . Lang::get('lang.unassigned'), route('unassigned')); $breadcrumbs->push(Lang::get('lang.tickets').'&nbsp; > &nbsp;'.Lang::get('lang.unassigned'), route('unassigned'));
}); });
Route::get('/ticket/unassigned', ['as' => 'get.unassigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_unassigned']); /* Get tickets in datatable */ Route::get('/ticket/unassigned', ['as' => 'get.unassigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_unassigned']); /* Get tickets in datatable */
Route::get('dashboard', ['as' => 'dashboard', 'uses' => 'Agent\helpdesk\DashboardController@index']); /* To show dashboard pages */ Route::get('dashboard', ['as' => 'dashboard', 'uses' => 'Agent\helpdesk\DashboardController@index']); /* To show dashboard pages */
@@ -627,17 +627,17 @@ Route::group(['middleware' => ['web']], function () {
Route::get('/{dept}/open', ['as' => 'dept.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptopen']); // Open Route::get('/{dept}/open', ['as' => 'dept.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptopen']); // Open
Breadcrumbs::register('dept.open.ticket', function ($breadcrumbs, $dept) { Breadcrumbs::register('dept.open.ticket', function ($breadcrumbs, $dept) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.department') . '&nbsp; > &nbsp;' . $dept . '&nbsp; > &nbsp;' . Lang::get('lang.open_tickets'), url('/{dept}/open')); $breadcrumbs->push(Lang::get('lang.department').'&nbsp; > &nbsp;'.$dept.'&nbsp; > &nbsp;'.Lang::get('lang.open_tickets'), url('/{dept}/open'));
}); });
Route::get('/{dept}/assigned', ['as' => 'dept.inprogress.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptinprogress']); // Inprogress Route::get('/{dept}/assigned', ['as' => 'dept.inprogress.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptinprogress']); // Inprogress
Breadcrumbs::register('dept.inprogress.ticket', function ($breadcrumbs, $dept) { Breadcrumbs::register('dept.inprogress.ticket', function ($breadcrumbs, $dept) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.department') . '&nbsp; > &nbsp;' . $dept . '&nbsp; > &nbsp;' . Lang::get('lang.assigned_tickets'), url('/{dept}/inprogress')); $breadcrumbs->push(Lang::get('lang.department').'&nbsp; > &nbsp;'.$dept.'&nbsp; > &nbsp;'.Lang::get('lang.assigned_tickets'), url('/{dept}/inprogress'));
}); });
Route::get('/{dept}/closed', ['as' => 'dept.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptclose']); // Closed Route::get('/{dept}/closed', ['as' => 'dept.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptclose']); // Closed
Breadcrumbs::register('dept.closed.ticket', function ($breadcrumbs, $dept) { Breadcrumbs::register('dept.closed.ticket', function ($breadcrumbs, $dept) {
$breadcrumbs->parent('dashboard'); $breadcrumbs->parent('dashboard');
$breadcrumbs->push(Lang::get('lang.department') . '&nbsp; > &nbsp;' . $dept . '&nbsp; > &nbsp;' . Lang::get('lang.closed_tickets'), url('/{dept}/closed')); $breadcrumbs->push(Lang::get('lang.department').'&nbsp; > &nbsp;'.$dept.'&nbsp; > &nbsp;'.Lang::get('lang.closed_tickets'), url('/{dept}/closed'));
}); });
Route::post('rating/{id}', ['as' => 'ticket.rating', 'uses' => 'Agent\helpdesk\TicketController@rating']); /* Get overall Ratings */ Route::post('rating/{id}', ['as' => 'ticket.rating', 'uses' => 'Agent\helpdesk\TicketController@rating']); /* Get overall Ratings */
Route::post('rating2/{id}', ['as' => 'ticket.rating2', 'uses' => 'Agent\helpdesk\TicketController@ratingReply']); /* Get reply Ratings */ Route::post('rating2/{id}', ['as' => 'ticket.rating2', 'uses' => 'Agent\helpdesk\TicketController@ratingReply']); /* Get reply Ratings */
@@ -681,7 +681,7 @@ Route::group(['middleware' => ['web']], function () {
]; ];
} }
}); });
Route::post('postform/{id}', 'Client\helpdesk\FormController@postForm'); /* post the AJAX form for create a ticket by guest user */ Route::post('postform/{id}', 'Client\helpdesk\FormController@postForm'); /* post the AJAX form for create a ticket by guest user */
Route::post('postedform', 'Client\helpdesk\FormController@postedForm'); /* post the form to store the value */ Route::post('postedform', 'Client\helpdesk\FormController@postedForm'); /* post the form to store the value */
Route::get('check', 'CheckController@getcheck'); //testing checkbox auto-populate Route::get('check', 'CheckController@getcheck'); //testing checkbox auto-populate
@@ -701,7 +701,7 @@ Route::group(['middleware' => ['web']], function () {
Route::get('create-ticket', ['as' => 'form', 'uses' => 'Client\helpdesk\FormController@getForm']); //getform Route::get('create-ticket', ['as' => 'form', 'uses' => 'Client\helpdesk\FormController@getForm']); //getform
Route::get('mytickets/{id}', ['as' => 'ticketinfo', 'uses' => 'Client\helpdesk\GuestController@singleThread']); //detail ticket information Route::get('mytickets/{id}', ['as' => 'ticketinfo', 'uses' => 'Client\helpdesk\GuestController@singleThread']); //detail ticket information
Route::post('checkmyticket', 'Client\helpdesk\UnAuthController@PostCheckTicket'); //ticket ckeck Route::post('checkmyticket', 'Client\helpdesk\UnAuthController@PostCheckTicket'); //ticket ckeck
Route::get('check_ticket/{id}', ['as' => 'check_ticket', 'uses' => 'Client\helpdesk\GuestController@get_ticket_email']); //detail ticket information Route::get('check_ticket/{id}', ['as' => 'check_ticket', 'uses' => 'Client\helpdesk\GuestController@get_ticket_email']); //detail ticket information
Breadcrumbs::register('check_ticket', function ($breadcrumbs, $id) { Breadcrumbs::register('check_ticket', function ($breadcrumbs, $id) {
$page = \App\Model\helpdesk\Ticket\Tickets::whereId(1)->first(); $page = \App\Model\helpdesk\Ticket\Tickets::whereId(1)->first();
@@ -787,10 +787,10 @@ Route::group(['middleware' => ['web']], function () {
echo '</tr>'; echo '</tr>';
foreach ($routeCollection as $value) { foreach ($routeCollection as $value) {
echo '<tr>'; echo '<tr>';
echo '<td>' . $value->getMethods()[0] . '</td>'; echo '<td>'.$value->getMethods()[0].'</td>';
echo '<td>' . $value->getName() . '</td>'; echo '<td>'.$value->getName().'</td>';
echo '<td>' . $value->getPath() . '</td>'; echo '<td>'.$value->getPath().'</td>';
echo '<td>' . $value->getActionName() . '</td>'; echo '<td>'.$value->getActionName().'</td>';
echo '</tr>'; echo '</tr>';
} }
echo '</table>'; echo '</table>';
@@ -812,22 +812,22 @@ Route::group(['middleware' => ['web']], function () {
Breadcrumbs::register('error404', function ($breadcrumbs) { Breadcrumbs::register('error404', function ($breadcrumbs) {
$breadcrumbs->push('404'); $breadcrumbs->push('404');
}); });
Route::get('error-in-database-connection', ['as' => 'errordb', function() { Route::get('error-in-database-connection', ['as' => 'errordb', function () {
return view('errors.db'); return view('errors.db');
}]); }]);
Breadcrumbs::register('errordb', function ($breadcrumbs) { Breadcrumbs::register('errordb', function ($breadcrumbs) {
$breadcrumbs->push('Error establishing connection to database'); $breadcrumbs->push('Error establishing connection to database');
}); });
Route::get('unauthorized', ['as' => 'unauth', function() { Route::get('unauthorized', ['as' => 'unauth', function () {
return view('errors.unauth'); return view('errors.unauth');
}]); }]);
Breadcrumbs::register('unauth', function ($breadcrumbs) { Breadcrumbs::register('unauth', function ($breadcrumbs) {
$breadcrumbs->push('Unauthorized Access'); $breadcrumbs->push('Unauthorized Access');
}); });
Route::get('board-offline', ['as' => 'board.offline', function () { Route::get('board-offline', ['as' => 'board.offline', function () {
return view('errors.offline'); return view('errors.offline');
}]); }]);
@@ -935,7 +935,7 @@ Route::group(['middleware' => ['web']], function () {
Route::get('get-articles', ['as' => 'api.article', 'uses' => 'Agent\kb\ArticleController@getData']); Route::get('get-articles', ['as' => 'api.article', 'uses' => 'Agent\kb\ArticleController@getData']);
Route::get('get-categorys', ['as' => 'api.category', 'uses' => 'Agent\kb\CategoryController@getData']); Route::get('get-categorys', ['as' => 'api.category', 'uses' => 'Agent\kb\CategoryController@getData']);
Route::get('get-comment', ['as' => 'api.comment', 'uses' => 'Agent\kb\SettingsController@getData']); Route::get('get-comment', ['as' => 'api.comment', 'uses' => 'Agent\kb\SettingsController@getData']);
Route::post('image', 'Agent\kb\SettingsController@image'); Route::post('image', 'Agent\kb\SettingsController@image');
Route::get('direct', function () { Route::get('direct', function () {
return view('direct'); return view('direct');
@@ -1090,7 +1090,7 @@ Route::group(['middleware' => ['web']], function () {
Route::get('ticket/customers-custom', 'Api\v1\TestController@getCustomersWith'); Route::get('ticket/customers-custom', 'Api\v1\TestController@getCustomersWith');
Route::get('generate/token', 'Api\v1\TestController@generateToken'); Route::get('generate/token', 'Api\v1\TestController@generateToken');
Route::get('get/user', 'Api\v1\TestController@getAuthUser'); Route::get('get/user', 'Api\v1\TestController@getAuthUser');
/* /*
* FCM token response * FCM token response
*/ */
@@ -1110,9 +1110,8 @@ Route::group(['middleware' => ['web']], function () {
$api_control = new \App\Http\Controllers\Common\ApiSettings(); $api_control = new \App\Http\Controllers\Common\ApiSettings();
$api_control->ticketDetailEvent($details); $api_control->ticketDetailEvent($details);
}); });
Route::get('test', ['as' => 'test', 'uses' => 'Common\PushNotificationController@response']); Route::get('test', ['as' => 'test', 'uses' => 'Common\PushNotificationController@response']);
});
});

View File

@@ -2,20 +2,20 @@
namespace App\Jobs; namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class SendEmail extends Job implements ShouldQueue class SendEmail extends Job implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, SerializesModels;
protected $from; protected $from;
protected $to; protected $to;
protected $message; protected $message;
/** /**
* Create a new job instance. * Create a new job instance.
* *

View File

@@ -6,8 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class FieldValue extends Model class FieldValue extends Model
{ {
protected $table = "field_values"; protected $table = 'field_values';
protected $fillable = ['field_id','parent_id','field_key','field_value']; protected $fillable = ['field_id', 'parent_id', 'field_key', 'field_value'];
} }

View File

@@ -4,8 +4,8 @@ namespace App\Model\helpdesk\Form;
use App\BaseModel; use App\BaseModel;
class Fields extends BaseModel { class Fields extends BaseModel
{
protected $table = 'custom_form_fields'; protected $table = 'custom_form_fields';
/** /**
@@ -15,17 +15,22 @@ class Fields extends BaseModel {
*/ */
protected $fillable = ['forms_id', 'label', 'name', 'type', 'value', 'required']; protected $fillable = ['forms_id', 'label', 'name', 'type', 'value', 'required'];
public function valueRelation() { public function valueRelation()
{
$related = "App\Model\helpdesk\Form\FieldValue"; $related = "App\Model\helpdesk\Form\FieldValue";
return $this->hasMany($related, 'field_id'); return $this->hasMany($related, 'field_id');
} }
public function values() { public function values()
{
$value = $this->valueRelation(); $value = $this->valueRelation();
return $value; return $value;
} }
public function deleteValues() { public function deleteValues()
{
$values = $this->values()->get(); $values = $this->values()->get();
if ($values->count() > 0) { if ($values->count() > 0) {
foreach ($values as $value) { foreach ($values as $value) {
@@ -34,9 +39,8 @@ class Fields extends BaseModel {
} }
} }
public function delete() { public function delete()
{
parent::delete(); parent::delete();
} }
} }

View File

@@ -14,50 +14,59 @@ class Forms extends BaseModel
* @var array * @var array
*/ */
protected $fillable = ['formname']; protected $fillable = ['formname'];
public function fieldRelation()
public function fieldRelation(){ {
$related = "App\Model\helpdesk\Form\Fields"; $related = "App\Model\helpdesk\Form\Fields";
return $this->hasMany($related); return $this->hasMany($related);
} }
public function fields(){ public function fields()
{
$relation = $this->fieldRelation()->get(); $relation = $this->fieldRelation()->get();
return $relation;
return $relation;
} }
public function fieldsDelete(){ public function fieldsDelete()
{
$fields = $this->fields(); $fields = $this->fields();
if($fields->count()>0){ if ($fields->count() > 0) {
foreach($fields as $field){ foreach ($fields as $field) {
$field->delete(); $field->delete();
} }
} }
} }
public function formValueRelation(){ public function formValueRelation()
{
$related = "App\Model\helpdesk\Form\FieldValue"; $related = "App\Model\helpdesk\Form\FieldValue";
return $this->hasMany($related,'child_id');
return $this->hasMany($related, 'child_id');
} }
public function formValueChild(){ public function formValueChild()
{
$childs = $this->formValueRelation()->get(); $childs = $this->formValueRelation()->get();
return $childs; return $childs;
} }
public function deleteFormChild(){ public function deleteFormChild()
{
$childs = $this->formValueChild(); $childs = $this->formValueChild();
if($childs->count()>0){ if ($childs->count() > 0) {
foreach ($childs as $child){ foreach ($childs as $child) {
$child->child_id = NULL; $child->child_id = null;
$child->save(); $child->save();
} }
} }
} }
public function delete() { public function delete()
{
$this->fieldsDelete(); $this->fieldsDelete();
parent::delete(); parent::delete();
} }
} }

View File

@@ -50,7 +50,7 @@ class AppServiceProvider extends ServiceProvider
\View::composer('themes.default1.update.notification', function () { \View::composer('themes.default1.update.notification', function () {
$notification = new BarNotification(); $notification = new BarNotification();
$not = [ $not = [
'notification' => $notification->where('value','!=','')->get(), 'notification' => $notification->where('value', '!=', '')->get(),
]; ];
view()->share($not); view()->share($not);
}); });

View File

@@ -28,7 +28,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic', protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic',
'phone_number', 'company', 'agent_sign', 'account_type', 'account_status', 'phone_number', 'company', 'agent_sign', 'account_type', 'account_status',
'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access', 'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access',
'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code','fcm_token' ]; 'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code', 'fcm_token', ];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.

View File

@@ -137,15 +137,15 @@ return [
'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider',
'DaveJamesMiller\Breadcrumbs\ServiceProvider', 'DaveJamesMiller\Breadcrumbs\ServiceProvider',
/* /*
* Laravel Framework Service Providers... * Laravel Framework Service Providers...
*/ */
// //
'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Bus\BusServiceProvider', 'Illuminate\Bus\BusServiceProvider',
@@ -187,7 +187,7 @@ return [
'Tymon\JWTAuth\Providers\JWTAuthServiceProvider', 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider',
'Torann\GeoIP\GeoIPServiceProvider', 'Torann\GeoIP\GeoIPServiceProvider',
LaravelFCM\FCMServiceProvider::class, LaravelFCM\FCMServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class, Barryvdh\Debugbar\ServiceProvider::class,
], ],
/* /*
@@ -250,7 +250,7 @@ return [
'Image' => Intervention\Image\Facades\Image::class, 'Image' => Intervention\Image\Facades\Image::class,
'FCM' => LaravelFCM\Facades\FCM::class, 'FCM' => LaravelFCM\Facades\FCM::class,
'FCMGroup' => LaravelFCM\Facades\FCMGroup::class, 'FCMGroup' => LaravelFCM\Facades\FCMGroup::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class,
], ],
'name' => 'faveo helpdesk community', 'name' => 'faveo helpdesk community',
]; ];

View File

@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -26,13 +26,13 @@ return array(
| can also be used. For PDO, run the package migrations first. | can also be used. For PDO, run the package migrations first.
| |
*/ */
'storage' => array( 'storage' => [
'enabled' => true, 'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom 'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver 'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO) 'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver 'provider' => '', // Instance of StorageInterface for custom driver
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -82,7 +82,7 @@ return array(
| |
*/ */
'collectors' => array( 'collectors' => [
'phpinfo' => true, // Php version 'phpinfo' => true, // Php version
'messages' => true, // Messages 'messages' => true, // Messages
'time' => true, // Time Datalogger 'time' => true, // Time Datalogger
@@ -103,7 +103,7 @@ return array(
'auth' => false, // Display Laravel authentication status 'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks 'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data 'session' => true, // Display session data
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -114,33 +114,33 @@ return array(
| |
*/ */
'options' => array( 'options' => [
'auth' => array( 'auth' => [
'show_name' => false, // Also show the users name/email in the debugbar 'show_name' => false, // Also show the users name/email in the debugbar
), ],
'db' => array( 'db' => [
'with_params' => true, // Render SQL with the parameters substituted 'with_params' => true, // Render SQL with the parameters substituted
'timeline' => false, // Add the queries to the timeline 'timeline' => false, // Add the queries to the timeline
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files. 'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries 'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
'enabled' => false, 'enabled' => false,
'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+ 'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
), ],
'hints' => true, // Show hints for common mistakes 'hints' => true, // Show hints for common mistakes
), ],
'mail' => array( 'mail' => [
'full_log' => false 'full_log' => false,
), ],
'views' => array( 'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large.. 'data' => false, //Note: Can slow down the application, because the data can be quite large..
), ],
'route' => array( 'route' => [
'label' => true // show complete route on bar 'label' => true, // show complete route on bar
), ],
'logs' => array( 'logs' => [
'file' => null 'file' => null,
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -167,4 +167,4 @@ return array(
*/ */
'route_prefix' => '_debugbar', 'route_prefix' => '_debugbar',
); ];

View File

@@ -1,14 +1,14 @@
<?php <?php
return [ return [
'driver' => env('FCM_PROTOCOL','http'), 'driver' => env('FCM_PROTOCOL', 'http'),
'log_enabled' => true, 'log_enabled' => true,
'http' => [ 'http' => [
'server_key' => env('FCM_SERVER_KEY','Your FCM server key'), 'server_key' => env('FCM_SERVER_KEY', 'Your FCM server key'),
'sender_id' => env('FCM_SENDER_ID', 'Your sender id'), 'sender_id' => env('FCM_SENDER_ID', 'Your sender id'),
'server_send_url' => 'https://fcm.googleapis.com/fcm/send', 'server_send_url' => 'https://fcm.googleapis.com/fcm/send',
'server_group_url' => 'https://android.googleapis.com/gcm/notification', 'server_group_url' => 'https://android.googleapis.com/gcm/notification',
'timeout' => 30.0, // in second 'timeout' => 30.0, // in second
] ],
]; ];

View File

@@ -1,6 +1,5 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class Version1079table extends Migration class Version1079table extends Migration
@@ -16,15 +15,13 @@ class Version1079table extends Migration
$current_version2 = explode(' ', $current_version1); $current_version2 = explode(' ', $current_version1);
$current_version = $current_version2[1]; $current_version = $current_version2[1];
$settings_system = DB::table('settings_system')->where('id', '=', '1')->first(); $settings_system = DB::table('settings_system')->where('id', '=', '1')->first();
if($settings_system != null) { if ($settings_system != null) {
DB::table('settings_system')->insert(['version' => $current_version]); DB::table('settings_system')->insert(['version' => $current_version]);
DB::table('common_settings') DB::table('common_settings')
->insert( ->insert(
['option_name' => 'enable_rtl', 'option_value' => ''], ['option_name' => 'enable_rtl', 'option_value' => ''],
['option_name' => 'user_set_ticket_status', 'status' => 1] ['option_name' => 'user_set_ticket_status', 'status' => 1]
); );
} }
} }
} }

View File

@@ -26,6 +26,7 @@ use App\Model\helpdesk\Utility\CountryCode;
use App\Model\helpdesk\Utility\Date_format; use App\Model\helpdesk\Utility\Date_format;
use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Languages; use App\Model\helpdesk\Utility\Languages;
use App\Model\helpdesk\Utility\Limit_Login;
use App\Model\helpdesk\Utility\Log_notification; use App\Model\helpdesk\Utility\Log_notification;
use App\Model\helpdesk\Utility\MailboxProtocol; use App\Model\helpdesk\Utility\MailboxProtocol;
use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Time_format;
@@ -33,7 +34,6 @@ use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Version_Check; use App\Model\helpdesk\Utility\Version_Check;
use App\Model\helpdesk\Workflow\WorkflowClose; use App\Model\helpdesk\Workflow\WorkflowClose;
use App\Model\kb\Settings; use App\Model\kb\Settings;
use App\Model\helpdesk\Utility\Limit_Login;
use App\Model\Update\BarNotification; use App\Model\Update\BarNotification;
// Knowledge base // Knowledge base
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@@ -1977,7 +1977,7 @@ class DatabaseSeeder extends Seeder
Security::create(['id' => '1', 'lockout_message' => 'You have been locked out of application due to too many failed login attempts.', 'backlist_offender' => '0', 'backlist_threshold' => '15', 'lockout_period' => '15', 'days_to_keep_logs' => '0']); Security::create(['id' => '1', 'lockout_message' => 'You have been locked out of application due to too many failed login attempts.', 'backlist_offender' => '0', 'backlist_threshold' => '15', 'lockout_period' => '15', 'days_to_keep_logs' => '0']);
Limit_Login::create(['id'=>'1']); Limit_Login::create(['id' => '1']);
TemplateSet::create(['id' => '1', 'name' => 'default', 'active' => '1']); TemplateSet::create(['id' => '1', 'name' => 'default', 'active' => '1']);

View File

@@ -35,13 +35,10 @@ if (!empty($_POST)) {
$value = htmlspecialchars(stripslashes((string) $value)); $value = htmlspecialchars(stripslashes((string) $value));
} else { } else {
$value = htmlspecialchars((string) $value); $value = htmlspecialchars((string) $value);
} } ?>
?>
<tr> <tr>
<th style="vertical-align: top"><?php echo htmlspecialchars((string) $key); <th style="vertical-align: top"><?php echo htmlspecialchars((string) $key); ?></th>
?></th> <td><pre class="samples"><?php echo $value; ?></pre></td>
<td><pre class="samples"><?php echo $value;
?></pre></td>
</tr> </tr>
<?php <?php

View File

@@ -28,7 +28,7 @@ return [
'we_are_sorry_but_the_page_you_are_looking_for_can_not_be_found' => 'We are sorry, but the page you are looking for can not be found.', 'we_are_sorry_but_the_page_you_are_looking_for_can_not_be_found' => 'We are sorry, but the page you are looking for can not be found.',
'go_back' => 'Go Back', 'go_back' => 'Go Back',
'the_board_is_offline' => 'The Board is Offline', 'the_board_is_offline' => 'The Board is Offline',
'error_establishing_connection_to_database' => 'Error establishing connection to database', 'error_establishing_connection_to_database' => 'Error establishing connection to database',
'unauthorized_access' => 'Unauthorized Access', 'unauthorized_access' => 'Unauthorized Access',
/* /*
|-------------------------------------- |--------------------------------------
@@ -285,7 +285,7 @@ return [
'Ticket-has-been-created-successfully-your-ticket-number-is' => 'Ticket has been created successfully, your ticket number is', 'Ticket-has-been-created-successfully-your-ticket-number-is' => 'Ticket has been created successfully, your ticket number is',
'Please-save-this-for-future-reference' => 'Please save this for future reference', 'Please-save-this-for-future-reference' => 'Please save this for future reference',
'rtl' => 'RTL (Right to left)', 'rtl' => 'RTL (Right to left)',
'the_rtl_support_is_only_applicable_to_the_outgoing_mails' => 'The RTL support is only applicable to the outgoing mails', 'the_rtl_support_is_only_applicable_to_the_outgoing_mails' => 'The RTL support is only applicable to the outgoing mails',
'user_set_ticket_status' => 'Allow users to set ticket status', 'user_set_ticket_status' => 'Allow users to set ticket status',
/* /*
|-------------------------------------- |--------------------------------------
@@ -435,7 +435,7 @@ return [
| Language page | Language page
|------------------------------------------------ |------------------------------------------------
*/ */
'default' => 'default', 'default' => 'default',
'language-settings' => 'Language Settings', 'language-settings' => 'Language Settings',
'iso-code' => 'ISO-CODE', 'iso-code' => 'ISO-CODE',
'download' => 'Downlaod', 'download' => 'Downlaod',
@@ -458,7 +458,7 @@ return [
'lang-doesnot-exist' => 'Language package does not exist.', 'lang-doesnot-exist' => 'Language package does not exist.',
'active-lang-error' => 'Language package can not be deleted when it is active.', 'active-lang-error' => 'Language package can not be deleted when it is active.',
'language-error' => 'Language package not found in your lang directroy.', 'language-error' => 'Language package not found in your lang directroy.',
'lang-fallback-lang' => 'Cannot delete system\'s defualt fallback language', 'lang-fallback-lang' => 'Cannot delete system\'s defualt fallback language',
/* /*
|-------------------------------------- |--------------------------------------
@@ -474,7 +474,7 @@ return [
'plugin-path-missing' => 'Plugin File Path is not exist', 'plugin-path-missing' => 'Plugin File Path is not exist',
'no-plugin-file' => 'Their is no ', 'no-plugin-file' => 'Their is no ',
'plugin-config-missing' => 'Their is no <b>config.php or ServiceProvider.php</b>', 'plugin-config-missing' => 'Their is no <b>config.php or ServiceProvider.php</b>',
/* /*
|---------------------------------------------------------------------------------------- |----------------------------------------------------------------------------------------
| Manage Pages [English(en)] | Manage Pages [English(en)]
@@ -1007,7 +1007,7 @@ return [
'organization_profile' => 'Organization Profile', 'organization_profile' => 'Organization Profile',
'organization-s_head' => "Organization's Head", 'organization-s_head' => "Organization's Head",
'select_department_manager' => 'Select Department Manager', 'select_department_manager' => 'Select Department Manager',
'select_organization_manager' => "Select Organization Manager", 'select_organization_manager' => 'Select Organization Manager',
'users_of' => 'Users of', 'users_of' => 'Users of',
'organization_created_successfully' => 'Organization Created Successfully', 'organization_created_successfully' => 'Organization Created Successfully',
'organization_can_not_create' => 'Organization can not Create', 'organization_can_not_create' => 'Organization can not Create',