Apply fixes from StyleCI

This commit is contained in:
Manish Verma
2018-08-06 05:18:13 +00:00
committed by StyleCI Bot
parent 4ec6000d69
commit c547b2e438
41 changed files with 373 additions and 308 deletions

View File

@@ -9,8 +9,8 @@ use App\Model\helpdesk\Ticket\Ticket_Thread;
use Config; use Config;
use Storage; use Storage;
class StorageController extends Controller { class StorageController extends Controller
{
protected $default; protected $default;
protected $driver; protected $driver;
protected $root; protected $root;
@@ -25,7 +25,8 @@ class StorageController extends Controller {
protected $rackspace_endpoint; protected $rackspace_endpoint;
protected $rackspace_url_type; protected $rackspace_url_type;
public function __construct() { public function __construct()
{
$this->default = $this->defaults(); $this->default = $this->defaults();
$this->driver = $this->driver(); $this->driver = $this->driver();
$this->root = $this->root(); $this->root = $this->root();
@@ -40,7 +41,8 @@ class StorageController extends Controller {
$this->rackspace_username = $this->rackspaceUsername(); $this->rackspace_username = $this->rackspaceUsername();
} }
protected function settings($option) { protected function settings($option)
{
$settings = new CommonSettings(); $settings = new CommonSettings();
$setting = $settings->getOptionValue('storage', $option); $setting = $settings->getOptionValue('storage', $option);
$value = ''; $value = '';
@@ -51,7 +53,8 @@ class StorageController extends Controller {
return $value; return $value;
} }
public function defaults() { public function defaults()
{
$default = 'local'; $default = 'local';
if ($this->settings('default')) { if ($this->settings('default')) {
$default = $this->settings('default'); $default = $this->settings('default');
@@ -60,11 +63,13 @@ class StorageController extends Controller {
return $default; return $default;
} }
public function driver() { public function driver()
{
return $this->settings('default'); return $this->settings('default');
} }
public function root() { public function root()
{
$root = storage_path('app'); $root = storage_path('app');
if ($this->settings('root')) { if ($this->settings('root')) {
$root = $this->settings('root'); $root = $this->settings('root');
@@ -73,47 +78,58 @@ class StorageController extends Controller {
return $root; return $root;
} }
public function s3Key() { public function s3Key()
{
return $this->settings('s3_key'); return $this->settings('s3_key');
} }
public function s3Region() { public function s3Region()
{
return $this->settings('s3_region'); return $this->settings('s3_region');
} }
public function s3Secret() { public function s3Secret()
{
return $this->settings('s3_secret'); return $this->settings('s3_secret');
} }
public function s3Bucket() { public function s3Bucket()
{
return $this->settings('s3_bucket'); return $this->settings('s3_bucket');
} }
public function rackspaceKey() { public function rackspaceKey()
{
return $this->settings('root'); return $this->settings('root');
} }
public function rackspaceRegion() { public function rackspaceRegion()
{
return $this->settings('rackspace_region'); return $this->settings('rackspace_region');
} }
public function rackspaceUsername() { public function rackspaceUsername()
{
return $this->settings('rackspace_username'); return $this->settings('rackspace_username');
} }
public function rackspaceContainer() { public function rackspaceContainer()
{
return $this->settings('rackspace_container'); return $this->settings('rackspace_container');
} }
public function rackspaceEndpoint() { public function rackspaceEndpoint()
{
return $this->settings('rackspace_endpoint'); return $this->settings('rackspace_endpoint');
} }
public function rackspaceUrlType() { public function rackspaceUrlType()
{
return $this->settings('rackspace_url_type'); return $this->settings('rackspace_url_type');
} }
protected function setFileSystem() { protected function setFileSystem()
{
$config = $this->config(); $config = $this->config();
//dd($config); //dd($config);
foreach ($config as $key => $con) { foreach ($config as $key => $con) {
@@ -128,7 +144,8 @@ class StorageController extends Controller {
return Config::get('filesystem'); return Config::get('filesystem');
} }
protected function config() { protected function config()
{
return [ return [
'default' => $this->default, 'default' => $this->default,
'cloud' => 's3', 'cloud' => 's3',
@@ -136,7 +153,8 @@ class StorageController extends Controller {
]; ];
} }
protected function disks() { protected function disks()
{
return [ return [
'local' => [ 'local' => [
'driver' => 'local', 'driver' => 'local',
@@ -161,7 +179,8 @@ class StorageController extends Controller {
]; ];
} }
public function upload($data, $filename, $type, $size, $disposition, $thread_id) { public function upload($data, $filename, $type, $size, $disposition, $thread_id)
{
$upload = new Ticket_attachments(); $upload = new Ticket_attachments();
$upload->thread_id = $thread_id; $upload->thread_id = $thread_id;
$upload->name = $filename; $upload->name = $filename;
@@ -185,23 +204,23 @@ class StorageController extends Controller {
} }
} }
public function saveAttachments($thread_id, $attachments = []) { public function saveAttachments($thread_id, $attachments = [])
{
$disposition = 'ATTACHMENT'; $disposition = 'ATTACHMENT';
$thread = ''; $thread = '';
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
if (is_object($attachment)) { if (is_object($attachment)) {
if (method_exists($attachment, 'getStructure')) { if (method_exists($attachment, 'getStructure')) {
$structure = $attachment->getStructure(); $structure = $attachment->getStructure();
if (isset($structure->disposition)) { if (isset($structure->disposition)) {
$disposition = $structure->disposition; $disposition = $structure->disposition;
} }
$filename = rand(1111, 9999) . "_" . $attachment->getFileName(); $filename = rand(1111, 9999).'_'.$attachment->getFileName();
$type = $attachment->getMimeType(); $type = $attachment->getMimeType();
$size = $attachment->getSize(); $size = $attachment->getSize();
$data = $attachment->getData(); $data = $attachment->getData();
} else { } else {
$filename = rand(1111, 9999) . "_" . $attachment->getClientOriginalName(); $filename = rand(1111, 9999).'_'.$attachment->getClientOriginalName();
$type = $attachment->getMimeType(); $type = $attachment->getMimeType();
$size = $attachment->getSize(); $size = $attachment->getSize();
$data = file_get_contents($attachment->getRealPath()); $data = file_get_contents($attachment->getRealPath());
@@ -210,10 +229,12 @@ class StorageController extends Controller {
$thread = $this->updateBody($attachment, $thread_id, $filename); $thread = $this->updateBody($attachment, $thread_id, $filename);
} }
} }
return $thread; return $thread;
} }
public function updateBody($attachment, $thread_id, $filename) { public function updateBody($attachment, $thread_id, $filename)
{
$threads = new Ticket_Thread(); $threads = new Ticket_Thread();
$thread = $threads->find($thread_id); $thread = $threads->find($thread_id);
$disposition = 'ATTACHMENT'; $disposition = 'ATTACHMENT';
@@ -235,17 +256,19 @@ class StorageController extends Controller {
$thread->body = $body; $thread->body = $body;
$thread->save(); $thread->save();
} }
return $thread; return $thread;
} }
public function getFile($drive, $name, $root) { public function getFile($drive, $name, $root)
if ($drive != "database") { {
if ($drive != 'database') {
$root = $root.DIRECTORY_SEPARATOR.$name; $root = $root.DIRECTORY_SEPARATOR.$name;
if (\File::exists($root)) { if (\File::exists($root)) {
chmod($root, 0755); chmod($root, 0755);
return \File::get($root); return \File::get($root);
} }
} }
} }
} }

View File

@@ -271,10 +271,12 @@ class AgentController extends Controller
$team_assign_agent = $team_assign_agent->where('agent_id', $id); $team_assign_agent = $team_assign_agent->where('agent_id', $id);
$team_assign_agent->delete(); $team_assign_agent->delete();
$user = $user->whereId($id)->first(); $user = $user->whereId($id)->first();
try { try {
$error = Lang::get('lang.this_staff_is_related_to_some_tickets'); $error = Lang::get('lang.this_staff_is_related_to_some_tickets');
$user->id; $user->id;
$user->delete(); $user->delete();
throw new \Exception($error); throw new \Exception($error);
return redirect('agents')->with('success', Lang::get('lang.agent_deleted_sucessfully')); return redirect('agents')->with('success', Lang::get('lang.agent_deleted_sucessfully'));
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -428,6 +428,7 @@ class EmailsController extends Controller
return redirect('emails')->with('fails', Lang::get('lang.you_cannot_delete_system_default_email')); return redirect('emails')->with('fails', Lang::get('lang.you_cannot_delete_system_default_email'));
} }
} }
try { try {
// fetching the database instance of the current email // fetching the database instance of the current email
$emails = $email->whereId($id)->first(); $emails = $email->whereId($id)->first();

View File

@@ -106,6 +106,7 @@ class FormController extends Controller
return view('themes.default1.admin.helpdesk.manage.form.preview', compact('form', 'fields')); return view('themes.default1.admin.helpdesk.manage.form.preview', compact('form', 'fields'));
} }
throw new Exception("Sorry we can't find your request"); throw new Exception("Sorry we can't find your request");
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
@@ -125,6 +126,7 @@ class FormController extends Controller
'name.*' => 'required', 'name.*' => 'required',
'type.*' => 'required', 'type.*' => 'required',
]); ]);
try { try {
$forms = new Forms(); $forms = new Forms();
$require = Input::get('required'); $require = Input::get('required');
@@ -195,6 +197,7 @@ class FormController extends Controller
//dd($fields); //dd($fields);
return view('themes.default1.admin.helpdesk.manage.form.edit', compact('form', 'fields', 'select_forms')); return view('themes.default1.admin.helpdesk.manage.form.edit', compact('form', 'fields', 'select_forms'));
} }
throw new Exception("Sorry we can't find your request"); throw new Exception("Sorry we can't find your request");
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
@@ -213,6 +216,7 @@ class FormController extends Controller
//dd($fields); //dd($fields);
return view('themes.default1.admin.helpdesk.manage.form.add-child', compact('form', 'fields', 'select_forms')); return view('themes.default1.admin.helpdesk.manage.form.add-child', compact('form', 'fields', 'select_forms'));
} }
throw new Exception("Sorry we can't find your request"); throw new Exception("Sorry we can't find your request");
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
@@ -227,6 +231,7 @@ class FormController extends Controller
'name.*' => 'required', 'name.*' => 'required',
'type.*' => 'required', 'type.*' => 'required',
]); ]);
try { try {
if (!$request->input('formname')) { if (!$request->input('formname')) {
throw new Exception(Lang::get('lang.please_fill_form_name')); throw new Exception(Lang::get('lang.please_fill_form_name'));
@@ -391,6 +396,7 @@ class FormController extends Controller
public function addChild($fieldid, Request $request) public function addChild($fieldid, Request $request)
{ {
$ids = $request->except('_token'); $ids = $request->except('_token');
try { try {
foreach ($ids as $valueid => $formid) { foreach ($ids as $valueid => $formid) {
$field_value = new \App\Model\helpdesk\Form\FieldValue(); $field_value = new \App\Model\helpdesk\Form\FieldValue();

View File

@@ -32,6 +32,7 @@ class SocialMediaController extends Controller
'client_secret' => 'required', 'client_secret' => 'required',
'redirect' => 'required|url', 'redirect' => 'required|url',
]); ]);
try { try {
$requests = $request->except('_token'); $requests = $request->except('_token');
$this->insertProvider($provider, $requests); $this->insertProvider($provider, $requests);

View File

@@ -149,6 +149,7 @@ class WorkflowController extends Controller
$email_data["E-$key"] = $email; $email_data["E-$key"] = $email;
} }
$emails = $email_data; $emails = $email_data;
try { try {
return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails')); return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails'));
} catch (Exception $e) { } catch (Exception $e) {

View File

@@ -37,10 +37,11 @@ use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\User; use App\User;
use Auth; use Auth;
use Crypt;
use DB; use DB;
use Exception; use Exception;
use GeoIP;
// classes // classes
use GeoIP;
use Hash; use Hash;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\support\Collection; use Illuminate\support\Collection;
@@ -49,7 +50,6 @@ use Lang;
use Mail; use Mail;
use PDF; use PDF;
use UTC; use UTC;
use Crypt;
/** /**
* TicketController. * TicketController.
@@ -398,6 +398,7 @@ class TicketController extends Controller
public function reply(Ticket_Thread $thread, Request $request, Ticket_attachments $ta, $mail = true, $system_reply = true, $user_id = '') public function reply(Ticket_Thread $thread, Request $request, Ticket_attachments $ta, $mail = true, $system_reply = true, $user_id = '')
{ {
\Event::fire('reply.request', [$request]); \Event::fire('reply.request', [$request]);
try { try {
if (is_array($request->file('attachment'))) { if (is_array($request->file('attachment'))) {
} else { } else {
@@ -543,7 +544,7 @@ class TicketController extends Controller
'ticket_number' => $ticket_number, 'ticket_number' => $ticket_number,
'user' => $username, 'user' => $username,
'agent_sign' => $agentsign, 'agent_sign' => $agentsign,
'system_link'=>$link 'system_link' => $link,
] ]
); );
} }
@@ -810,6 +811,7 @@ class TicketController extends Controller
} }
// Event fire // Event fire
\Event::fire(new \App\Events\ReadMailEvent($user_id, $password)); \Event::fire(new \App\Events\ReadMailEvent($user_id, $password));
try { try {
if ($auto_response == 0) { if ($auto_response == 0) {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->first_name, 'email' => $emailadd], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $user->first_name, 'email_address' => $emailadd, 'user_password' => $password]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->first_name, 'email' => $emailadd], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $user->first_name, 'email_address' => $emailadd, 'user_password' => $password]);
@@ -862,6 +864,7 @@ class TicketController extends Controller
} }
} else { } else {
$body2 = null; $body2 = null;
try { try {
if ($auto_response == 0) { if ($auto_response == 0) {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'], $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'],
@@ -1260,6 +1263,7 @@ class TicketController extends Controller
} else { } else {
$from_email = $sending_emails->id; $from_email = $sending_emails->id;
} }
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket_status->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket_status->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -1496,6 +1500,7 @@ class TicketController extends Controller
$agent_email = $user_detail->email; $agent_email = $user_detail->email;
$ticket_link = route('ticket.thread', $id); $ticket_link = route('ticket.thread', $id);
$master = Auth::user()->first_name.' '.Auth::user()->last_name; $master = Auth::user()->first_name.' '.Auth::user()->last_name;
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -1629,6 +1634,7 @@ class TicketController extends Controller
$create_user->password = Hash::make($password); $create_user->password = Hash::make($password);
$create_user->save(); $create_user->save();
$user_id = $create_user->id; $user_id = $create_user->id;
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -2316,6 +2322,7 @@ class TicketController extends Controller
$user->role = 'user'; $user->role = 'user';
if ($user->save()) { if ($user->save()) {
$user_id = $user->id; $user_id = $user->id;
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -298,6 +298,7 @@ class UserController extends Controller
$password = $this->generateRandomString(); $password = $this->generateRandomString();
$user->password = Hash::make($password); $user->password = Hash::make($password);
$user->role = 'user'; $user->role = 'user';
try { try {
if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) { if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) {
return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput(); return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput();
@@ -708,6 +709,7 @@ class UserController extends Controller
public function getProfile() public function getProfile()
{ {
$user = Auth::user(); $user = Auth::user();
try { try {
return view('themes.default1.agent.helpdesk.user.profile', compact('user')); return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -727,6 +729,7 @@ class UserController extends Controller
$phonecode = $code->where('iso', '=', $location->iso_code)->first(); $phonecode = $code->where('iso', '=', $location->iso_code)->first();
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first(); $settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$status = $settings->status; $status = $settings->status;
try { try {
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')) return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'))
->with(['phonecode' => $phonecode->phonecode, ->with(['phonecode' => $phonecode->phonecode,
@@ -769,7 +772,7 @@ class UserController extends Controller
// fetching upload destination path // fetching upload destination path
$destinationPath = 'uploads/profilepic'; $destinationPath = 'uploads/profilepic';
// adding a random value to profile picture filename // adding a random value to profile picture filename
$fileName = rand(0000, 9999).'.'.str_replace(" ", "_", $name); $fileName = rand(0000, 9999).'.'.str_replace(' ', '_', $name);
// moving the picture to a destination folder // moving the picture to a destination folder
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database // saving filename to database
@@ -805,6 +808,7 @@ class UserController extends Controller
// checking if the old password matches the new password // checking if the old password matches the new password
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
try { try {
$user->save(); $user->save();

View File

@@ -51,6 +51,7 @@ class PageController extends Controller
{ {
$pages = $this->page->paginate(3); $pages = $this->page->paginate(3);
$pages->setPath('page'); $pages->setPath('page');
try { try {
return view('themes.default1.agent.kb.pages.index', compact('pages')); return view('themes.default1.agent.kb.pages.index', compact('pages'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -128,6 +129,7 @@ class PageController extends Controller
$sl = $request->input('name'); $sl = $request->input('name');
$slug = str_slug($sl, '-'); $slug = str_slug($sl, '-');
$this->page->slug = $slug; $this->page->slug = $slug;
try { try {
$this->page->fill($request->input())->save(); $this->page->fill($request->input())->save();
@@ -169,6 +171,7 @@ class PageController extends Controller
$pages = $this->page->where('slug', $slug)->first(); $pages = $this->page->where('slug', $slug)->first();
$sl = $request->input('name'); $sl = $request->input('name');
$slug = str_slug($sl, '-'); $slug = str_slug($sl, '-');
try { try {
$pages->fill($request->all())->save(); $pages->fill($request->all())->save();
$pages->slug = $slug; $pages->slug = $slug;

View File

@@ -61,6 +61,7 @@ class ApiController extends Controller
$this->middleware('jwt.auth'); $this->middleware('jwt.auth');
$this->middleware('api', ['except' => 'GenerateApiKey']); $this->middleware('api', ['except' => 'GenerateApiKey']);
try { try {
$user = \JWTAuth::parseToken()->authenticate(); $user = \JWTAuth::parseToken()->authenticate();
$this->user = $user; $this->user = $user;
@@ -1288,6 +1289,7 @@ 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();
//return $emails; //return $emails;

View File

@@ -713,6 +713,7 @@ class TicketController extends Controller
return $collab; return $collab;
} catch (\Exception $ex) { } catch (\Exception $ex) {
return $ex->getMessage(); return $ex->getMessage();
throw new \Exception('get collaborator for ticket fails'); throw new \Exception('get collaborator for ticket fails');
} }
} }

View File

@@ -249,6 +249,7 @@ class FormController extends Controller
} }
} catch (\Exception $ex) { } catch (\Exception $ex) {
dd($ex); dd($ex);
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
// dd($result); // dd($result);

View File

@@ -101,7 +101,7 @@ class GuestController extends Controller
// fetching upload destination path // fetching upload destination path
$destinationPath = 'uploads/profilepic'; $destinationPath = 'uploads/profilepic';
// adding a random value to profile picture filename // adding a random value to profile picture filename
$fileName = rand(0000, 9999).'.'.str_replace(" ", "_", $name); $fileName = rand(0000, 9999).'.'.str_replace(' ', '_', $name);
// moving the picture to a destination folder // moving the picture to a destination folder
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database // saving filename to database
@@ -237,6 +237,7 @@ class GuestController extends Controller
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
try { try {
$user->save(); $user->save();

View File

@@ -94,6 +94,7 @@ class UnAuthController extends Controller
$ticket_token->token = $hashed_token; $ticket_token->token = $hashed_token;
$ticket_token->save(); $ticket_token->save();
} }
try { try {
$this->PhpMailController->sendmail( $this->PhpMailController->sendmail(
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user_details->email], $message = ['subject' => 'Ticket link Request ['.$ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => url('show-ticket/'.$ticket->id.'/'.$token)] $from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user_details->email], $message = ['subject' => 'Ticket link Request ['.$ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => url('show-ticket/'.$ticket->id.'/'.$token)]
@@ -270,6 +271,7 @@ class UnAuthController extends Controller
} else { } else {
$from_email = $sending_emails->id; $from_email = $sending_emails->id;
} }
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]);
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -51,6 +51,7 @@ class ApiSettings extends Controller
$this->validate($request, [ $this->validate($request, [
'ticket_detail' => 'url', 'ticket_detail' => 'url',
]); ]);
try { try {
// dd($request->input()); // dd($request->input());
DB::table('settings_system') DB::table('settings_system')
@@ -91,6 +92,7 @@ class ApiSettings extends Controller
$this->postHook($data); $this->postHook($data);
} catch (Exception $ex) { } catch (Exception $ex) {
dd($ex); dd($ex);
throw new Exception($ex->getMessage()); throw new Exception($ex->getMessage());
} }
} }
@@ -106,6 +108,7 @@ class ApiSettings extends Controller
} }
} catch (Exception $ex) { } catch (Exception $ex) {
dd($ex); dd($ex);
throw new Exception($ex->getMessage()); throw new Exception($ex->getMessage());
} }
} }

View File

@@ -120,6 +120,7 @@ class SettingsController extends Controller
$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();
@@ -198,6 +199,7 @@ class SettingsController extends Controller
$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();
@@ -234,6 +236,7 @@ class SettingsController extends Controller
$data->name = $request->input('name'); $data->name = $request->input('name');
$data->email = $request->input('email'); $data->email = $request->input('email');
$data->password = Crypt::encrypt($request->input('password')); $data->password = Crypt::encrypt($request->input('password'));
try { try {
$data->save(); $data->save();
@@ -257,6 +260,7 @@ class SettingsController extends Controller
$pass = $request->input('password'); $pass = $request->input('password');
$password = Crypt::encrypt($pass); $password = Crypt::encrypt($pass);
$settings->password = $password; $settings->password = $password;
try { try {
$settings->save(); $settings->save();
} catch (Exception $e) { } catch (Exception $e) {
@@ -270,6 +274,7 @@ class SettingsController extends Controller
$settings->logo = $fileName; $settings->logo = $fileName;
$settings->save(); $settings->save();
} }
try { try {
$settings->fill($request->except('logo', 'password'))->save(); $settings->fill($request->except('logo', 'password'))->save();
@@ -364,6 +369,7 @@ class SettingsController extends Controller
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');

View File

@@ -375,6 +375,7 @@ class InstallController extends Controller
$datacontent2 = str_replace('http://localhost', $link, $datacontent2); $datacontent2 = str_replace('http://localhost', $link, $datacontent2);
File::put($app_url, $datacontent2); File::put($app_url, $datacontent2);
$language = Cache::get('language'); $language = Cache::get('language');
try { try {
Cache::flush(); Cache::flush();

View File

@@ -43,6 +43,7 @@ class MailController extends Controller
public function getServiceForm($short_name) public function getServiceForm($short_name)
{ {
$form = ''; $form = '';
try { try {
switch ($short_name) { switch ($short_name) {
case 'smtp': case 'smtp':

View File

@@ -4,11 +4,9 @@ namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
use Lang;
class VerifyCsrfToken extends BaseVerifier class VerifyCsrfToken extends BaseVerifier
{ {
/** /**
* The URIs that should be excluded from CSRF verification. * The URIs that should be excluded from CSRF verification.
* *
@@ -16,7 +14,7 @@ class VerifyCsrfToken extends BaseVerifier
*/ */
protected $except = [ protected $except = [
'CheckSerial', 'CheckSerial',
'api/v1/*' 'api/v1/*',
]; ];
/** /**

View File

@@ -29,6 +29,7 @@ class TicketRequest extends Request
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) {

View File

@@ -35,7 +35,7 @@ class Ticket_attachments extends Model
if ($content) { if ($content) {
$value = base64_encode($content); $value = base64_encode($content);
if (mime($this->type) != 'image') { if (mime($this->type) != 'image') {
$root = $root . "/" . $name; $root = $root.'/'.$name;
chmod($root, 1204); chmod($root, 1204);
} }
} }

View File

@@ -45,7 +45,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
$pic = $this->checkArray('avatar', $info); $pic = $this->checkArray('avatar', $info);
} }
if (!$pic && $value) { if (!$pic && $value) {
$pic = ""; $pic = '';
$file = asset('uploads/profilepic/'.$value); $file = asset('uploads/profilepic/'.$value);
if ($file) { if ($file) {
$type = pathinfo($file, PATHINFO_EXTENSION); $type = pathinfo($file, PATHINFO_EXTENSION);
@@ -56,6 +56,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
if (!$value) { if (!$value) {
$pic = \Gravatar::src($this->attributes['email']); $pic = \Gravatar::src($this->attributes['email']);
} }
return $pic; return $pic;
} }

View File

@@ -41,7 +41,6 @@ if (!empty($_POST)) {
<td><pre class="samples"><?php echo $value; ?></pre></td> <td><pre class="samples"><?php echo $value; ?></pre></td>
</tr> </tr>
<?php <?php
} }
} }
?> ?>