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

View File

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

View File

@@ -3,8 +3,8 @@
namespace App\Http\Controllers\Admin\helpdesk;
// controller
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Controller;
// request
use App\Http\Requests\helpdesk\AgentRequest;
use App\Http\Requests\helpdesk\AgentUpdate;

View File

@@ -29,14 +29,15 @@ use Lang;
*
* @author Ladybird <info@ladybirdweb.com>
*/
class DepartmentController extends Controller {
class DepartmentController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() {
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
@@ -48,9 +49,11 @@ class DepartmentController extends Controller {
*
* @return type Response
*/
public function index(Department $department) {
public function index(Department $department)
{
try {
$departments = $department->get();
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
} catch (Exception $e) {
return view('404');
@@ -70,7 +73,8 @@ class DepartmentController extends Controller {
*
* @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 {
$slas = $sla->get();
$user = $user->where('role', 'agent2')->get();
@@ -93,7 +97,8 @@ class DepartmentController extends Controller {
*
* @return type Response
*/
public function store(Department $department, DepartmentRequest $request) {
public function store(Department $department, DepartmentRequest $request)
{
try {
$department->fill($request->except('group_id', 'manager', 'sla'))->save();
if ($request->sla) {
@@ -116,6 +121,7 @@ class DepartmentController extends Controller {
->where('id', 1)
->update(['department' => $department->id]);
}
return redirect('departments')->with('success', Lang::get('lang.department_created_sucessfully'));
} else {
return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department'));
@@ -140,7 +146,8 @@ class DepartmentController extends Controller {
*
* @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 {
$sys_department = \DB::table('settings_system')
->select('department')
@@ -170,7 +177,8 @@ class DepartmentController extends Controller {
*
* @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);
try {
$table = $group_assign_department->where('department_id', $id);
@@ -218,7 +226,8 @@ class DepartmentController extends Controller {
*
* @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 {
$system = $system->where('id', '=', '1')->first();
@@ -277,5 +286,4 @@ class DepartmentController extends Controller {
}
}
}
}

View File

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

View File

@@ -103,7 +103,6 @@ class LanguageController extends Controller
} else {
return Config::get('languages.'.$model);
}
})
->addColumn('id', function ($model) {
return $model;
@@ -249,6 +248,7 @@ class LanguageController extends Controller
}
} else {
Session::flash('fails', Lang::get('lang.lang-fallback-lang'));
return redirect('languages');
}
} else {
@@ -257,5 +257,4 @@ class LanguageController extends Controller
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\Ratings\Rating;
use App\Model\helpdesk\Settings\Alert;
use App\Model\helpdesk\Settings\CommonSettings;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email;
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\Timezones;
use App\Model\helpdesk\Workflow\WorkflowClose;
use App\Model\helpdesk\Settings\CommonSettings;
use DateTime;
// classes
use DB;

View File

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

View File

@@ -27,15 +27,16 @@ use PhpImap\Mailbox as ImapMailbox;
*
* @author Ladybird <info@ladybirdweb.com>
*/
class MailController extends Controller {
class MailController extends Controller
{
/**
* constructor
* Create a new controller instance.
*
* @param type TicketController $TicketController
*/
public function __construct(TicketWorkflowController $TicketWorkflowController) {
public function __construct(TicketWorkflowController $TicketWorkflowController)
{
$this->middleware('board');
$this->TicketWorkflowController = $TicketWorkflowController;
}
@@ -45,7 +46,8 @@ class MailController extends Controller {
*
* @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;
if ($settings_email->first()->email_fetching == 1) {
if ($settings_email->first()->all_emails == 1) {
@@ -96,13 +98,13 @@ class MailController extends Controller {
try {
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
} catch (\PhpImap\Exception $e) {
echo "Connection error";
echo 'Connection error';
}
$mails = [];
try {
$mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
} catch (\PhpImap\Exception $e) {
echo "Connection error";
echo 'Connection error';
}
if (!$mailsIds) {
die('Mailbox is empty');
@@ -119,7 +121,7 @@ class MailController extends Controller {
try {
$mail = $mailbox->getMail($mailId);
} catch (\PhpImap\Exception $e) {
echo "Connection error";
echo 'Connection error';
}
if ($settings_email->first()->email_collaborator == 1) {
$collaborator = $mail->cc;
@@ -137,11 +139,11 @@ class MailController extends Controller {
if ($body == null) {
$attach = $mail->getAttachments();
if (is_array($attach)) {
if (key_exists('html-body', $attach)) {
if (array_key_exists('html-body', $attach)) {
$path = $attach['html-body']->filePath;
}
if ($path == null) {
if (key_exists('text-body', $attach)) {
if (array_key_exists('text-body', $attach)) {
$path = $attach['text-body']->filePath;
}
}
@@ -151,7 +153,7 @@ class MailController extends Controller {
if ($body) {
$body = self::trimTableTag($body);
} else {
$body = "";
$body = '';
}
}
}
@@ -251,7 +253,8 @@ class MailController extends Controller {
*
* @return type string
*/
public function separate_reply($body) {
public function separate_reply($body)
{
$body2 = explode('---Reply above this line---', $body);
$body3 = $body2[0];
@@ -265,7 +268,8 @@ class MailController extends Controller {
*
* @return type string
*/
public function decode_imap_text($str) {
public function decode_imap_text($str)
{
$result = '';
$decode_header = imap_mime_header_decode($str);
foreach ($decode_header as $obj) {
@@ -280,7 +284,8 @@ class MailController extends Controller {
*
* @return type
*/
public function fetch_attachments() {
public function fetch_attachments()
{
$uploads = Upload::all();
foreach ($uploads as $attachment) {
$image = @imagecreatefromstring($attachment->file);
@@ -300,7 +305,8 @@ class MailController extends Controller {
*
* @return type file
*/
public function get_data($id) {
public function get_data($id)
{
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
foreach ($attachments as $attachment) {
header('Content-type: application/'.$attachment->type.'');
@@ -310,7 +316,8 @@ class MailController extends Controller {
}
}
public static function trimTableTag($html) {
public static function trimTableTag($html)
{
if (strpos('<table>', $html) != false) {
$first_pos = strpos($html, '<table');
$fist_string = substr_replace($html, '', 0, $first_pos);
@@ -326,13 +333,15 @@ class MailController extends Controller {
return $html;
}
public static function trim3D($html) {
public static function trim3D($html)
{
$body = str_replace('=3D', '', $html);
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 = [];
foreach ($tags as $key => $tag) {
$replace[$key] = htmlspecialchars($tag);
@@ -341,5 +350,4 @@ class MailController extends Controller {
return $body;
}
}

View File

@@ -22,16 +22,18 @@ use View;
*
* @author Ladybird <info@ladybirdweb.com>
*/
class NotificationController extends Controller {
public function __construct(PhpMailController $PhpMailController) {
class NotificationController extends Controller
{
public function __construct(PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController;
}
/**
* This function is for sending daily report/notification about the system.
* */
public function send_notification() {
public function send_notification()
{
//fetching email settings
$email = Email::where('id', '=', '1')->first();
// 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();
$date = explode(' ', $notification->created_at);
if (date('Y-m-d') == $date[0]) {
} else {
// creating a daily notification log
Log_notification::create(['log' => 'NOT-1']);
@@ -64,7 +65,8 @@ class NotificationController extends Controller {
*
* @return mail
* */
public function send_notification_to_admin($company) {
public function send_notification_to_admin($company)
{
// get all admin users
$users = User::where('role', '=', 'admin')->get();
foreach ($users as $user) {
@@ -76,12 +78,12 @@ class NotificationController extends Controller {
$from = $this->PhpMailController->mailfrom('1', '0');
$to = [
'name' => $user_name,
'email' => $email
'email' => $email,
];
$message = [
'subject' => 'Daily Report',
'scenario' => null,
'body' => $contents
'body' => $contents,
];
$this->dispatch((new \App\Jobs\SendEmail($from, $to, $message))->onQueue('emails'));
//$this->PhpMailController->sendEmail($from,$to,$message);
@@ -93,7 +95,8 @@ class NotificationController extends Controller {
*
* @return mail
* */
public function send_notification_to_manager($company) {
public function send_notification_to_manager($company)
{
// get all department managers
$depts = Department::all();
foreach ($depts as $dept) {
@@ -117,7 +120,8 @@ class NotificationController extends Controller {
*
* @return mail
* */
public function send_notification_to_team_lead($company) {
public function send_notification_to_team_lead($company)
{
// get all Team leads
$teams = Teams::all();
foreach ($teams as $team) {
@@ -141,7 +145,8 @@ class NotificationController extends Controller {
*
* @return mail
* */
public function send_notification_to_agent($company) {
public function send_notification_to_agent($company)
{
// get all agents users
$users = User::where('role', '=', 'agent')->get();
foreach ($users as $user) {
@@ -159,7 +164,8 @@ class NotificationController extends Controller {
*
* @return type variable
*/
public function company() {
public function company()
{
// fetching comapny model
$company = Company::Where('id', '=', '1')->first();
// fetching company name
@@ -171,5 +177,4 @@ class NotificationController extends Controller {
return $company;
}
}

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Agent\helpdesk;
// controllers
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests
// 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
*
* @return type
*/
public function getOpenTickets($id)
@@ -63,6 +64,7 @@ class Ticket2Controller extends Controller
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
}
return Ttable::getTable($tickets);
}
@@ -86,8 +88,10 @@ class Ticket2Controller extends Controller
}
/**
* 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
*
* @return type
*/
public function getCloseTickets($id)
@@ -98,12 +102,15 @@ class Ticket2Controller extends Controller
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', '2')->where('status', '=', '3')->where('dept_id', '=', $dept->id)->get();
}
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
*
* @return type
*/
public function deptinprogress($id)
@@ -136,5 +143,4 @@ class Ticket2Controller extends Controller
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);
}
}
return $ticket_settings_details;
}

View File

@@ -3,8 +3,8 @@
namespace App\Http\Controllers\Agent\helpdesk;
// controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Controller;
// requests
/* Include Sys_user Model */
use App\Http\Requests\helpdesk\ProfilePassword;
@@ -79,7 +79,7 @@ class UserController extends Controller
public function user_list()
{
// 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 */
->searchColumns('user_name', 'email', 'phone')
/* order column username and email */
@@ -511,7 +511,6 @@ class UserController extends Controller
}
}
/**
* Generate a random string for password.
*
@@ -534,5 +533,4 @@ class UserController extends Controller
// return random string
return $randomString;
}
}

View File

@@ -77,6 +77,7 @@ class CategoryController extends Controller
/* add column name */
->addColumn('name', function ($model) {
$string = strip_tags($model->name);
return str_limit($string, 20);
})
/* add column Created */
@@ -147,6 +148,7 @@ class CategoryController extends Controller
// send success message to index page
try {
$category->fill($request->input())->save();
return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully'));
} catch (Exception $e) {
return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>');
@@ -191,6 +193,7 @@ class CategoryController extends Controller
try {
$category->slug = $slug;
$category->fill($request->input())->save();
return redirect('category')->with('success', Lang::get('lang.category_updated_successfully'));
} catch (Exception $e) {
//redirect to index with fails message

View File

@@ -33,8 +33,8 @@ use Illuminate\Support\Collection;
*
* @version v1
*/
class ApiController extends Controller {
class ApiController extends Controller
{
public $user;
public $request;
public $ticket;
@@ -54,7 +54,8 @@ class ApiController extends Controller {
/**
* @param Request $request
*/
public function __construct(Request $request) {
public function __construct(Request $request)
{
$this->request = $request;
$this->middleware('jwt.auth');
@@ -63,9 +64,7 @@ class ApiController extends Controller {
$user = \JWTAuth::parseToken()->authenticate();
$this->user = $user;
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
}
$ticket = new TicketController();
@@ -120,7 +119,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function createTicket() {
public function createTicket()
{
try {
$v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id',
@@ -189,7 +189,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function ticketReply() {
public function ticketReply()
{
//dd($this->request->all());
try {
$v = \Validator::make($this->request->all(), [
@@ -223,7 +224,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function editTicket() {
public function editTicket()
{
try {
$v = \Validator::make($this->request->all(), [
'ticket_id' => 'required|exists:tickets,id',
@@ -260,7 +262,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function deleteTicket() {
public function deleteTicket()
{
try {
$v = \Validator::make($this->request->all(), [
'ticket_id' => 'required|exists:tickets,id',
@@ -293,7 +296,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function openedTickets() {
public function openedTickets()
{
try {
// $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
// return response()->json(compact('result'));
@@ -337,7 +341,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function unassignedTickets() {
public function unassignedTickets()
{
try {
//dd('sdhjbc');
// $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
@@ -381,7 +386,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function closeTickets() {
public function closeTickets()
{
try {
// $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
// return response()->json(compact('result'));
@@ -425,7 +431,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getAgents() {
public function getAgents()
{
try {
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
@@ -448,7 +455,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getTeams() {
public function getTeams()
{
try {
$result = $this->team->get();
@@ -471,7 +479,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function assignTicket() {
public function assignTicket()
{
try {
$v = \Validator::make($this->request->all(), [
'ticket_id' => 'required',
@@ -509,7 +518,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getCustomers() {
public function getCustomers()
{
try {
$v = \Validator::make($this->request->all(), [
'search' => 'required',
@@ -543,7 +553,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getCustomersWith() {
public function getCustomersWith()
{
try {
$users = $this->user
->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id')
@@ -574,7 +585,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getCustomer() {
public function getCustomer()
{
try {
$v = \Validator::make($this->request->all(), [
'user_id' => 'required',
@@ -606,7 +618,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function searchTicket() {
public function searchTicket()
{
try {
$v = \Validator::make($this->request->all(), [
'search' => 'required',
@@ -638,7 +651,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function ticketThreads() {
public function ticketThreads()
{
try {
$v = \Validator::make($this->request->all(), [
'id' => 'required',
@@ -675,7 +689,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function checkUrl() {
public function checkUrl()
{
//dd($this->request);
try {
$v = \Validator::make($this->request->all(), [
@@ -712,7 +727,8 @@ class ApiController extends Controller {
*
* @return string
*/
public function urlResult() {
public function urlResult()
{
return 'success';
}
@@ -723,7 +739,8 @@ class ApiController extends Controller {
*
* @return type int|string|json
*/
public function callGetApi($url) {
public function callGetApi($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url);
@@ -747,7 +764,8 @@ class ApiController extends Controller {
*
* @return type int|string|json
*/
public function callPostApi($url, $data) {
public function callPostApi($url, $data)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url);
@@ -769,7 +787,8 @@ class ApiController extends Controller {
*
* @return type | json
*/
public function generateApiKey() {
public function generateApiKey()
{
try {
$set = $this->setting->where('id', '1')->first();
//dd($set);
@@ -803,7 +822,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getHelpTopic() {
public function getHelpTopic()
{
try {
$result = $this->helptopic->get();
@@ -826,7 +846,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getSlaPlan() {
public function getSlaPlan()
{
try {
$result = $this->slaPlan->get();
@@ -849,7 +870,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getPriority() {
public function getPriority()
{
try {
$result = $this->priority->get();
@@ -872,7 +894,8 @@ class ApiController extends Controller {
*
* @return json
*/
public function getDepartment() {
public function getDepartment()
{
try {
$result = $this->department->get();
@@ -895,7 +918,8 @@ class ApiController extends Controller {
*
* @return type json
*/
public function getTickets() {
public function getTickets()
{
try {
$tickets = $this->model->orderBy('created_at', 'desc')->paginate(10);
$tickets->toJson();
@@ -919,9 +943,9 @@ class ApiController extends Controller {
*
* @return type json
*/
public function inbox() {
public function inbox()
{
try {
$inbox = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id')
->where('status', '=', 1);
@@ -961,7 +985,8 @@ class ApiController extends Controller {
*
* @return type json
*/
public function internalNote() {
public function internalNote()
{
try {
$v = \Validator::make($this->request->all(), [
'userid' => 'required|exists:users,id',
@@ -993,7 +1018,8 @@ class ApiController extends Controller {
}
}
public function getTrash() {
public function getTrash()
{
try {
$trash = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id')
@@ -1029,7 +1055,8 @@ class ApiController extends Controller {
}
}
public function getMyTicketsAgent() {
public function getMyTicketsAgent()
{
try {
$v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id',
@@ -1081,7 +1108,8 @@ class ApiController extends Controller {
}
}
public function getMyTicketsUser() {
public function getMyTicketsUser()
{
try {
$v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id',
@@ -1132,7 +1160,8 @@ class ApiController extends Controller {
}
}
public function getTicketById() {
public function getTicketById()
{
try {
$v = \Validator::make($this->request->all(), [
'id' => 'required|exists:tickets,id',
@@ -1171,7 +1200,8 @@ class ApiController extends Controller {
}
}
public function createPagination($array, $perPage) {
public function createPagination($array, $perPage)
{
try {
//Get current page form url e.g. &page=6
$currentPage = LengthAwarePaginator::resolveCurrentPage();
@@ -1199,7 +1229,8 @@ class ApiController extends Controller {
}
}
public function collaboratorSearch() {
public function collaboratorSearch()
{
$this->validate($this->request, ['term' => 'required']);
try {
$emails = $this->ticket->autosearch();
@@ -1226,7 +1257,8 @@ class ApiController extends Controller {
}
}
public function avatarUrl($email) {
public function avatarUrl($email)
{
try {
$user = new User();
$user = $user->where('email', $email)->first();
@@ -1243,7 +1275,8 @@ class ApiController extends Controller {
}
}
public function addCollaboratorForTicket() {
public function addCollaboratorForTicket()
{
try {
$v = \Validator::make(\Input::get(), [
'email' => 'required|email|unique:users',
@@ -1273,7 +1306,8 @@ class ApiController extends Controller {
}
}
public function getCollaboratorForTicket() {
public function getCollaboratorForTicket()
{
try {
$v = \Validator::make(\Input::get(), [
'ticket_id' => 'required',
@@ -1302,7 +1336,8 @@ class ApiController extends Controller {
}
}
public function deleteCollaborator() {
public function deleteCollaborator()
{
try {
$v = \Validator::make(\Input::get(), [
'ticketid' => 'required',
@@ -1326,7 +1361,8 @@ class ApiController extends Controller {
}
}
public function dependency() {
public function dependency()
{
try {
$department = $this->department->select('name', 'id')->get()->toArray();
$sla = $this->slaPlan->select('name', 'id')->get()->toArray();
@@ -1349,7 +1385,8 @@ class ApiController extends Controller {
}
}
public function differenciateHelpTopic($query){
public function differenciateHelpTopic($query)
{
$ticket = $query->first();
$check = 'department';
if ($ticket) {
@@ -1365,7 +1402,8 @@ class ApiController extends Controller {
}
}
public function getSystem($check,$query){
public function getSystem($check, $query)
{
switch ($check) {
case 'department':
return $query->select('tickets.dept_id');
@@ -1375,6 +1413,7 @@ class ApiController extends Controller {
return $query->select('tickets.dept_id');
}
}
/**
* Register a user with username and password.
*
@@ -1400,7 +1439,7 @@ class ApiController extends Controller {
$password = \Hash::make($request->input('password'));
$role = $request->input('role');
if ($auth->role == 'agent') {
$role = "user";
$role = 'user';
}
$user = new User();
$user->password = $password;
@@ -1408,6 +1447,7 @@ class ApiController extends Controller {
$user->email = $email;
$user->role = $role;
$user->save();
return response()->json(compact('user'));
} catch (\Exception $e) {
$error = $e->getMessage();
@@ -1415,6 +1455,4 @@ class ApiController extends Controller {
return response()->json(compact('error'));
}
}
}

View File

@@ -5,33 +5,31 @@ namespace App\Http\Controllers\Api\v1;
// Controllers
use App\Http\Controllers\Controller;
// Requests
use Illuminate\Http\Request;
// Models
use App\User;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_Thread;
// Models
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use FCM;
// classes
use LaravelFCM\Message\PayloadNotificationBuilder;
use LaravelFCM\Message\Topics;
use Illuminate\Http\Request;
use LaravelFCM\Message\OptionsBuilder;
use LaravelFCM\Message\PayloadDataBuilder;
use LaravelFCM\Message\PayloadNotificationBuilder;
use LaravelFCM\Response\DownstreamResponse;
use FCM;
use FCMGroup;
/**
* **********************************************
* PushNotificationController
* **********************************************
* 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>
*/
class PushNotificationController extends Controller {
public function Response($token, $body, $ticket_id = null) {
class PushNotificationController extends Controller
{
public function Response($token, $body, $ticket_id = null)
{
$optionBuiler = new OptionsBuilder();
$optionBuiler->setTimeToLive(60 * 60);
@@ -76,15 +74,18 @@ class PushNotificationController extends Controller {
/**
* function to get the fcm token from the api under a user.
*
* @param \Illuminate\Http\Request $request
*
* @return type
*/
public function fcmToken(Request $request, User $user) {
public function fcmToken(Request $request, User $user)
{
// get the requested details
$user_id = $request->input('user_id');
$fcm_token = $request->input('fcm_token');
// 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
$user = $user->where('id', '=', $user_id)->first();
if ($user != null) {
@@ -101,5 +102,4 @@ class PushNotificationController extends Controller {
return ['response' => 'fail', 'reason' => 'Invalid Credentials'];
}
}
}

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Auth;
// controllers
use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests
use App\Http\Requests\helpdesk\LoginRequest;
@@ -279,14 +278,14 @@ class AuthController extends Controller
$attempts = $data->Attempts + 1;
if ($attempts == $apt) {
// $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 {
$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'");
}
} else {
// $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;
} else {
$this->clearLoginAttempts($value, $field);
return 0;
}
}

View File

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

View File

@@ -33,15 +33,16 @@ use Redirect;
*
* @author Ladybird <info@ladybirdweb.com>
*/
class FormController extends Controller {
class FormController extends Controller
{
/**
* Create a new controller instance.
* Constructor to check.
*
* @return void
*/
public function __construct(TicketWorkflowController $TicketWorkflowController) {
public function __construct(TicketWorkflowController $TicketWorkflowController)
{
$this->middleware('board');
// creating a TicketController instance
$this->TicketWorkflowController = $TicketWorkflowController;
@@ -54,7 +55,8 @@ class FormController extends Controller {
*
* @return type
*/
public function getForm(Help_topic $topic, CountryCode $code) {
public function getForm(Help_topic $topic, CountryCode $code)
{
if (\Config::get('database.install') == '%0%') {
return \Redirect::route('licence');
}
@@ -66,8 +68,9 @@ class FormController extends Controller {
if ($phonecode->phonecode) {
$phonecode = $phonecode->phonecode;
} else {
$phonecode = "";
$phonecode = '';
}
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
} else {
return \Redirect::route('home');
@@ -82,35 +85,35 @@ class FormController extends Controller {
*
* @return type string
*/
public function postForm($id, Help_topic $topic) {
public function postForm($id, Help_topic $topic)
{
if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) {
}
if ($values) {
foreach ($values as $form_data) {
if ($form_data->type == "select") {
if ($form_data->type == 'select') {
$form_fields = explode(',', $form_data->value);
$var = "";
$var = '';
foreach ($form_fields as $form_field) {
$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>';
} elseif ($form_data->type == "radio") {
} elseif ($form_data->type == 'radio') {
$type2 = $form_data->value;
$vals = explode(',', $type2);
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
foreach ($vals as $val) {
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$val.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
}
echo "<br/>";
} elseif ($form_data->type == "textarea") {
echo '<br/>';
} elseif ($form_data->type == 'textarea') {
$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>';
} elseif ($form_data->type == "checkbox") {
} elseif ($form_data->type == 'checkbox') {
$type4 = $form_data->value;
$checks = explode(',', $type4);
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
@@ -134,7 +137,8 @@ class FormController extends Controller {
* @param type Request $request
* @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');
$name = $request->input('Name');
@@ -215,7 +219,8 @@ class FormController extends Controller {
*
* @return type view
*/
public function post_ticket_reply($id, Request $request) {
public function post_ticket_reply($id, Request $request)
{
try {
if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first();
@@ -255,13 +260,14 @@ class FormController extends Controller {
}
}
public function getCustomForm(Request $request) {
$html = "";
public function getCustomForm(Request $request)
{
$html = '';
$helptopic_id = $request->input('helptopic');
$helptopics = new Help_topic();
$helptopic = $helptopics->find($helptopic_id);
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;
if ($custom_form) {
@@ -270,7 +276,7 @@ class FormController extends Controller {
$form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms);
$html = $form_controller->renderForm($custom_form);
}
return $html;
}
}

View File

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

View File

@@ -24,9 +24,10 @@ use Lang;
use Mail;
use Redirect;
class UserController extends Controller {
public function __construct() {
class UserController extends Controller
{
public function __construct()
{
$this->middleware('board');
}
@@ -35,7 +36,8 @@ class UserController extends Controller {
*
* @return response
*/
public function getArticle(Article $article, Category $category, Settings $settings) {
public function getArticle(Article $article, Category $category, Settings $settings)
{
$setting = $settings->first();
$pagination = $setting->pagination;
if (!Auth::check() || \Auth::user()->role == 'user') {
@@ -47,6 +49,7 @@ class UserController extends Controller {
$article->setPath('article-list');
$categorys = $category->get();
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
}
@@ -59,7 +62,8 @@ class UserController extends Controller {
*
* @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) {
$excerpt = substr($str, $startPos, $maxLength - 3);
$lastSpace = strrpos($excerpt, ' ');
@@ -82,7 +86,8 @@ class UserController extends Controller {
*
* @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();
$pagination = $settings->pagination;
$search = $request->input('s');
@@ -101,7 +106,8 @@ class UserController extends Controller {
*
* @return response
*/
public function show($slug, Article $article, Category $category) {
public function show($slug, Article $article, Category $category)
{
//ArticleController::timezone();
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
@@ -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 */
$catid = $category->where('slug', $slug)->first();
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'));
}
public function home(Article $article, Category $category, Relationship $relation) {
public function home(Article $article, Category $category, Relationship $relation)
{
if (Config::get('database.install') == '%0%') {
return redirect('step1');
} 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();
$categorys = $category->get();
@@ -165,7 +174,8 @@ class UserController extends Controller {
*
* @return response
*/
public function contact(Category $category, Settings $settings) {
public function contact(Category $category, Settings $settings)
{
$settings = $settings->whereId('1')->first();
$categorys = $category->get();
@@ -177,7 +187,8 @@ class UserController extends Controller {
*
* @return response
*/
public function postContact(ContactRequest $request, Contact $contact) {
public function postContact(ContactRequest $request, Contact $contact)
{
$this->port();
$this->host();
$this->encryption();
@@ -204,7 +215,8 @@ class UserController extends Controller {
}
}
public function contactDetails() {
public function contactDetails()
{
return view('themes.default1.client.kb.article-list.contact-details');
}
@@ -218,7 +230,8 @@ class UserController extends Controller {
*
* @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();
if (!$article) {
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
@@ -232,7 +245,8 @@ class UserController extends Controller {
}
}
public function getPage($name, Page $page) {
public function getPage($name, Page $page)
{
$page = $page->where('slug', $name)->first();
if ($page) {
return view('themes.default1.client.kb.article-list.pages', compact('page'));
@@ -241,33 +255,39 @@ class UserController extends Controller {
}
}
public static function port() {
public static function port()
{
$setting = Settings::whereId('1')->first();
Config::set('mail.port', $setting->port);
}
public static function host() {
public static function host()
{
$setting = Settings::whereId('1')->first();
Config::set('mail.host', $setting->host);
}
public static function encryption() {
public static function encryption()
{
$setting = Settings::whereId('1')->first();
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
}
public static function email() {
public static function email()
{
$setting = Settings::whereId('1')->first();
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
//dd(Config::get('mail'));
}
public static function password() {
public static function password()
{
$setting = Settings::whereId('1')->first();
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->setPath('home');
@@ -289,13 +309,15 @@ class UserController extends Controller {
// //return substr($date, 0, -6);
// }
public function clientProfile() {
public function clientProfile()
{
$user = Auth::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->gender = $request->input('gender');
$user->save();
@@ -328,7 +350,8 @@ class UserController extends Controller {
}
}
public function postClientProfilePassword($id, ProfilePassword $request) {
public function postClientProfilePassword($id, ProfilePassword $request)
{
$user = Auth::user();
//echo $user->password;
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'));
}
}
}

View File

@@ -4,9 +4,10 @@ namespace App\Http\Controllers\Common;
use App\Http\Controllers\Controller;
class FileuploadController extends Controller {
public function __construct() {
class FileuploadController extends Controller
{
public function __construct()
{
// checking authentication
$this->middleware('auth');
// 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
// and post_max_size
function file_upload_max_size() {
public function file_upload_max_size()
{
static $max_size = -1;
if ($max_size < 0) {
@@ -31,11 +33,13 @@ class FileuploadController extends Controller {
$max_size_in_actual = ini_get('upload_max_filesize');
}
}
return ['0' => $max_size_in_bytes, '1' => $max_size_in_actual];
// 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.
$size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
if ($unit) {
@@ -45,5 +49,4 @@ class FileuploadController extends Controller {
return round($size);
}
}
}

View File

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

View File

@@ -6,16 +6,18 @@ use App\Http\Controllers\Controller;
use App\Model\Common\TemplateType;
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\CommonSettings;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Settings\CommonSettings;
use App\User;
use Auth;
class PhpMailController extends Controller {
public function fetch_smtp_details($id) {
class PhpMailController extends Controller
{
public function fetch_smtp_details($id)
{
$emails = Emails::where('id', '=', $id)->first();
return $emails;
}
@@ -24,7 +26,8 @@ class PhpMailController extends Controller {
*
* @return Mail
*/
public function sendmail($from, $to, $message, $template_variables) {
public function sendmail($from, $to, $message, $template_variables)
{
// try {
// dd($from);
$from_address = $this->fetch_smtp_details($from);
@@ -262,7 +265,7 @@ class PhpMailController extends Controller {
$mail->addAttachment($file_path, $file_name);
}
}
$mail->CharSet = "utf8";
$mail->CharSet = 'utf8';
$mail->Subject = $subject;
if ($template == 'ticket-reply-agent') {
$line = '---Reply above this line--- <br/><br/>';
@@ -291,7 +294,8 @@ class PhpMailController extends Controller {
*
* @return MailNotification
*/
public function sendEmail($from, $to, $message) {
public function sendEmail($from, $to, $message)
{
try {
$from_address = $this->fetch_smtp_details($from);
if ($from_address == null) {
@@ -403,7 +407,7 @@ class PhpMailController extends Controller {
$mail->addAttachment($file_path, $file_name);
}
}
$mail->CharSet = "utf8";
$mail->CharSet = 'utf8';
$mail->Subject = $subject;
$mail->Body = $content;
if (!$mail->send()) {
@@ -422,7 +426,8 @@ class PhpMailController extends Controller {
*
* @return type
*/
public function company() {
public function company()
{
$company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) {
$company = 'Support Center';
@@ -441,7 +446,8 @@ class PhpMailController extends Controller {
*
* @return type integer
*/
public function mailfrom($reg, $dept_id) {
public function mailfrom($reg, $dept_id)
{
$email = Email::where('id', '=', '1')->first();
if ($reg == 1) {
return $email->sys_email;
@@ -454,5 +460,4 @@ class PhpMailController extends Controller {
}
}
}
}

View File

@@ -5,39 +5,35 @@ namespace App\Http\Controllers\Common;
// Controllers
use App\Http\Controllers\Controller;
// Requests
use Illuminate\Http\Request;
// Models
use App\User;
// classes
use LaravelFCM\Message\PayloadNotificationBuilder;
use LaravelFCM\Message\Topics;
use LaravelFCM\Message\OptionsBuilder;
use LaravelFCM\Message\PayloadDataBuilder;
use LaravelFCM\Response\DownstreamResponse;
// Models
use FCM;
use FCMGroup;
// classes
use Illuminate\Http\Request;
/**
* **********************************************
* PushNotificationController
* **********************************************
* 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>
*/
class PushNotificationController extends Controller {
public function response($token, User $user) {
class PushNotificationController extends Controller
{
public function response($token, User $user)
{
}
/**
* function to get the fcm token from the api under a user.
*
* @param \Illuminate\Http\Request $request
*
* @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
use App\Model\helpdesk\Settings\Plugin;
use App\Model\helpdesk\Theme\Widgets;
use App\Model\helpdesk\Utility\Version_Check;
use Config;
// classes
use Crypt;
@@ -27,14 +26,15 @@ use Lang;
* ***************************
* Controller to keep smtp details and fetch where ever needed.
*/
class SettingsController extends Controller {
class SettingsController extends Controller
{
/**
* Create a new controller instance.
*
* @return type void
*/
public function __construct() {
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
@@ -44,7 +44,8 @@ class SettingsController extends Controller {
*
* @return response
*/
public function widgets() {
public function widgets()
{
return view('themes.default1.admin.helpdesk.theme.widgets');
}
@@ -53,7 +54,8 @@ class SettingsController extends Controller {
*
* @return response
*/
public function list_widget() {
public function list_widget()
{
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
->searchColumns('name')
->orderColumns('name', 'title', 'value')
@@ -112,12 +114,14 @@ class SettingsController extends Controller {
*
* @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->title = $request->title;
$widget->value = $request->content;
try {
$widget->save();
return redirect()->back()->with('success', $widget->name.Lang::get('lang.saved_successfully'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
@@ -129,7 +133,8 @@ class SettingsController extends Controller {
*
* @return response
*/
public function social_buttons() {
public function social_buttons()
{
return view('themes.default1.admin.helpdesk.theme.social');
}
@@ -138,7 +143,8 @@ class SettingsController extends Controller {
*
* @return response
*/
public function list_social_buttons() {
public function list_social_buttons()
{
return \Datatable::collection(Widgets::where('id', '>', '6')->get())
->searchColumns('name')
->orderColumns('name', 'value')
@@ -185,7 +191,8 @@ class SettingsController extends Controller {
*
* @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->title = $request->title;
$widget->value = $request->content;
@@ -203,8 +210,10 @@ class SettingsController extends Controller {
*
* @return type view
*/
public function getsmtp() {
public function getsmtp()
{
$settings = Smtp::where('id', '=', '1')->first();
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
}
@@ -213,7 +222,8 @@ class SettingsController extends Controller {
*
* @return type view
*/
public function postsmtp(SmtpRequest $request) {
public function postsmtp(SmtpRequest $request)
{
$data = Smtp::where('id', '=', 1)->first();
$data->driver = $request->input('driver');
$data->host = $request->input('host');
@@ -224,6 +234,7 @@ class SettingsController extends Controller {
$data->password = Crypt::encrypt($request->input('password'));
try {
$data->save();
return \Redirect::route('getsmtp')->with('success', 'success');
} catch (Exception $e) {
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
@@ -238,7 +249,8 @@ class SettingsController extends Controller {
*
* @return type view
*/
public function PostSettings(Settings $set, Request $request) {
public function PostSettings(Settings $set, Request $request)
{
$settings = $set->where('id', '1')->first();
$pass = $request->input('password');
$password = Crypt::encrypt($pass);
@@ -265,11 +277,13 @@ class SettingsController extends Controller {
}
}
public function Plugins() {
public function Plugins()
{
return view('themes.default1.admin.helpdesk.settings.plugins');
}
public function GetPlugin() {
public function GetPlugin()
{
$plugins = $this->fetchConfig();
return \Datatable::collection(new Collection($plugins))
@@ -330,7 +344,8 @@ class SettingsController extends Controller {
*
* @return type
*/
public function ReadPlugins() {
public function ReadPlugins()
{
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins';
$plugins = array_diff(scandir($dir), ['.', '..']);
@@ -344,7 +359,8 @@ class SettingsController extends Controller {
*
* @return type
*/
public function PostPlugins(Request $request) {
public function PostPlugins(Request $request)
{
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
try {
if (!extension_loaded('zip')) {
@@ -433,7 +449,8 @@ class SettingsController extends Controller {
*
* @return bool
*/
public function deleteDirectory($dir) {
public function deleteDirectory($dir)
{
if (!file_exists($dir)) {
return true;
}
@@ -454,7 +471,8 @@ class SettingsController extends Controller {
return rmdir($dir);
}
public function ReadConfigs() {
public function ReadConfigs()
{
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR;
$directories = scandir($dir);
$files = [];
@@ -495,7 +513,8 @@ class SettingsController extends Controller {
}
}
public function fetchConfig() {
public function fetchConfig()
{
$configs = $this->ReadConfigs();
//dd($configs);
$plugs = new Plugin();
@@ -531,7 +550,8 @@ class SettingsController extends Controller {
return $attributes;
}
public function DeletePlugin($slug) {
public function DeletePlugin($slug)
{
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$slug;
$this->deleteDirectory($dir);
/*
@@ -551,7 +571,8 @@ class SettingsController extends Controller {
return redirect()->back()->with('success', 'Deleted Successfully');
}
public function StatusPlugin($slug) {
public function StatusPlugin($slug)
{
$plugs = new Plugin();
$plug = $plugs->where('name', $slug)->first();
if (!$plug) {

View File

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

View File

@@ -9,16 +9,18 @@ use Artisan;
use Exception;
use Illuminate\Http\Request;
class UpgradeController extends Controller {
class UpgradeController extends Controller
{
public $dir;
public function __construct() {
public function __construct()
{
$dir = base_path();
$this->dir = $dir;
}
public function getLatestVersion() {
public function getLatestVersion()
{
try {
$name = \Config::get('app.name');
//dd($name);
@@ -38,7 +40,7 @@ class UpgradeController extends Controller {
$data = Utility::encryptByFaveoPublicKey(json_encode($data));
//dd($data);
$post_data = [
'data' => $data
'data' => $data,
];
$url = 'http://faveohelpdesk.com/billing/public/verification';
if (str_contains($url, ' ')) {
@@ -59,7 +61,8 @@ class UpgradeController extends Controller {
}
}
public function downloadLatestCode() {
public function downloadLatestCode()
{
$name = \Config::get('app.name');
$durl = 'http://www.faveohelpdesk.com/billing/public/download-url';
if (str_contains($durl, ' ')) {
@@ -75,7 +78,8 @@ class UpgradeController extends Controller {
return $download_url;
}
public function saveLatestCodeAtTemp($download_url) {
public function saveLatestCodeAtTemp($download_url)
{
echo '<p>Downloading New Update</p>';
$context = stream_context_create(
[
@@ -99,19 +103,22 @@ class UpgradeController extends Controller {
echo '<p>Update Downloaded And Saved</p>';
}
public function doUpdate() {
public function doUpdate()
{
try {
$memory_limit = ini_get('memory_limit');
if ($memory_limit < 256) {
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 '</ul>';
return 0;
}
if (!extension_loaded('zip')) {
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 '</ul>';
return 0;
}
//Artisan::call('down');
@@ -166,12 +173,13 @@ class UpgradeController extends Controller {
return true;
} catch (Exception $ex) {
echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>";
echo "<li style='color:red;'>".$ex->getMessage().'</li>';
echo '</ul>';
}
}
public function copyToActualDirectory($latest_version) {
public function copyToActualDirectory($latest_version)
{
try {
echo '<ul class=list-unstyled>';
$directory = "$this->dir/UPDATES";
@@ -190,17 +198,18 @@ class UpgradeController extends Controller {
$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>';
} catch (Exception $ex) {
echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>";
echo "<li style='color:red;'>".$ex->getMessage().'</li>';
echo '</ul>';
}
exit();
}
public function deleteBarNotification($key) {
public function deleteBarNotification($key)
{
try {
$noti = new BarNotification();
$notifications = $noti->where('key', $key)->get();
@@ -212,20 +221,24 @@ class UpgradeController extends Controller {
}
}
public function fileUpdate() {
public function fileUpdate()
{
try {
$latest_version = $this->getLatestVersion();
if (Utility::getFileVersion() < $latest_version) {
$url = url('file-upgrade');
return view('themes.default1.update.file', compact('url'));
}
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
public function fileUpgrading(Request $request) {
public function fileUpgrading(Request $request)
{
try {
//
$latest_version = $this->getLatestVersion();
@@ -233,10 +246,10 @@ class UpgradeController extends Controller {
$current_version = Utility::getFileVersion();
if ($latest_version != '') {
if (Utility::getFileVersion() < $latest_version) {
return view('themes.default1.update.update', compact('latest_version', 'current_version', 'request'));
}
}
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;
echo '<ul style=list-unstyled>';
for ($i = 0; $i < $ex; $i++) {
@@ -257,7 +271,8 @@ class UpgradeController extends Controller {
echo '</ul>';
}
public function fileUpgrading1(Request $request) {
public function fileUpgrading1(Request $request)
{
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
$latest_version = $this->getLatestVersion();
// dd($latest_version);
@@ -307,11 +322,12 @@ class UpgradeController extends Controller {
}
}
public function getCurl($url) {
public function getCurl($url)
{
try {
$curl = Utility::_isCurl();
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();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -328,11 +344,12 @@ class UpgradeController extends Controller {
}
}
public function postDownloadCurl($url, $data) {
public function postDownloadCurl($url, $data)
{
try {
$curl = Utility::_isCurl();
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();
curl_setopt($ch, CURLOPT_POST, 1);
@@ -344,17 +361,19 @@ class UpgradeController extends Controller {
}
$data = curl_exec($ch);
curl_close($ch);
return json_decode($data, true);
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
public function postCurl($url, $data) {
public function postCurl($url, $data)
{
try {
$curl = Utility::_isCurl();
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();
curl_setopt($ch, CURLOPT_POST, 1);
@@ -367,13 +386,15 @@ class UpgradeController extends Controller {
$data = curl_exec($ch);
curl_close($ch);
$data = Utility::decryptByFaveoPrivateKey($data);
return json_decode($data, true);
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
public function databaseUpdate() {
public function databaseUpdate()
{
try {
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
$url = url('database-upgrade');
@@ -387,7 +408,8 @@ class UpgradeController extends Controller {
}
}
public function databaseUpgrade() {
public function databaseUpgrade()
{
try {
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
Artisan::call('migrate', ['--force' => true]);
@@ -400,5 +422,4 @@ class UpgradeController extends Controller {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
}

View File

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

View File

@@ -3,6 +3,7 @@
namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request;
//use Illuminate\Http\Request as Req;
/**
* Sys_userUpdate.

View File

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

View File

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

View File

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

View File

@@ -1114,5 +1114,4 @@ Route::group(['middleware' => ['web']], function () {
Route::get('test', ['as' => 'test', 'uses' => 'Common\PushNotificationController@response']);
});

View File

@@ -2,11 +2,10 @@
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 Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class SendEmail extends Job implements ShouldQueue
{
@@ -16,6 +15,7 @@ class SendEmail extends Job implements ShouldQueue
protected $from;
protected $to;
protected $message;
/**
* Create a new job instance.
*

View File

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

View File

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

View File

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

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',
'phone_number', 'company', 'agent_sign', 'account_type', 'account_status',
'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.

View File

@@ -1,6 +1,6 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
@@ -26,13 +26,13 @@ return array(
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => array(
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'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
'messages' => true, // Messages
'time' => true, // Time Datalogger
@@ -103,7 +103,7 @@ return array(
'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
),
],
/*
|--------------------------------------------------------------------------
@@ -114,33 +114,33 @@ return array(
|
*/
'options' => array(
'auth' => array(
'options' => [
'auth' => [
'show_name' => false, // Also show the users name/email in the debugbar
),
'db' => array(
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'timeline' => false, // Add the queries to the timeline
'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,
'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
),
'mail' => array(
'full_log' => false
),
'views' => array(
],
'mail' => [
'full_log' => false,
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
),
'route' => array(
'label' => true // show complete route on bar
),
'logs' => array(
'file' => null
),
),
],
'route' => [
'label' => true, // show complete route on bar
],
'logs' => [
'file' => null,
],
],
/*
|--------------------------------------------------------------------------
@@ -167,4 +167,4 @@ return array(
*/
'route_prefix' => '_debugbar',
);
];

View File

@@ -10,5 +10,5 @@ return [
'server_send_url' => 'https://fcm.googleapis.com/fcm/send',
'server_group_url' => 'https://android.googleapis.com/gcm/notification',
'timeout' => 30.0, // in second
]
],
];

View File

@@ -1,6 +1,5 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Version1079table extends Migration
@@ -24,7 +23,5 @@ class Version1079table extends Migration
['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_time_format;
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\MailboxProtocol;
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\Workflow\WorkflowClose;
use App\Model\kb\Settings;
use App\Model\helpdesk\Utility\Limit_Login;
use App\Model\Update\BarNotification;
// Knowledge base
use Illuminate\Database\Seeder;

View File

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

View File

@@ -1007,7 +1007,7 @@ return [
'organization_profile' => 'Organization Profile',
'organization-s_head' => "Organization's Head",
'select_department_manager' => 'Select Department Manager',
'select_organization_manager' => "Select Organization Manager",
'select_organization_manager' => 'Select Organization Manager',
'users_of' => 'Users of',
'organization_created_successfully' => 'Organization Created Successfully',
'organization_can_not_create' => 'Organization can not Create',