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 Storage;
class StorageController extends Controller {
class StorageController extends Controller
{
protected $default;
protected $driver;
protected $root;
@@ -25,7 +25,8 @@ class StorageController extends Controller {
protected $rackspace_endpoint;
protected $rackspace_url_type;
public function __construct() {
public function __construct()
{
$this->default = $this->defaults();
$this->driver = $this->driver();
$this->root = $this->root();
@@ -40,7 +41,8 @@ class StorageController extends Controller {
$this->rackspace_username = $this->rackspaceUsername();
}
protected function settings($option) {
protected function settings($option)
{
$settings = new CommonSettings();
$setting = $settings->getOptionValue('storage', $option);
$value = '';
@@ -51,7 +53,8 @@ class StorageController extends Controller {
return $value;
}
public function defaults() {
public function defaults()
{
$default = 'local';
if ($this->settings('default')) {
$default = $this->settings('default');
@@ -60,11 +63,13 @@ class StorageController extends Controller {
return $default;
}
public function driver() {
public function driver()
{
return $this->settings('default');
}
public function root() {
public function root()
{
$root = storage_path('app');
if ($this->settings('root')) {
$root = $this->settings('root');
@@ -73,47 +78,58 @@ class StorageController extends Controller {
return $root;
}
public function s3Key() {
public function s3Key()
{
return $this->settings('s3_key');
}
public function s3Region() {
public function s3Region()
{
return $this->settings('s3_region');
}
public function s3Secret() {
public function s3Secret()
{
return $this->settings('s3_secret');
}
public function s3Bucket() {
public function s3Bucket()
{
return $this->settings('s3_bucket');
}
public function rackspaceKey() {
public function rackspaceKey()
{
return $this->settings('root');
}
public function rackspaceRegion() {
public function rackspaceRegion()
{
return $this->settings('rackspace_region');
}
public function rackspaceUsername() {
public function rackspaceUsername()
{
return $this->settings('rackspace_username');
}
public function rackspaceContainer() {
public function rackspaceContainer()
{
return $this->settings('rackspace_container');
}
public function rackspaceEndpoint() {
public function rackspaceEndpoint()
{
return $this->settings('rackspace_endpoint');
}
public function rackspaceUrlType() {
public function rackspaceUrlType()
{
return $this->settings('rackspace_url_type');
}
protected function setFileSystem() {
protected function setFileSystem()
{
$config = $this->config();
//dd($config);
foreach ($config as $key => $con) {
@@ -128,7 +144,8 @@ class StorageController extends Controller {
return Config::get('filesystem');
}
protected function config() {
protected function config()
{
return [
'default' => $this->default,
'cloud' => 's3',
@@ -136,11 +153,12 @@ class StorageController extends Controller {
];
}
protected function disks() {
protected function disks()
{
return [
'local' => [
'driver' => 'local',
'root' => $this->root . '/attachments',
'root' => $this->root.'/attachments',
],
's3' => [
'driver' => 's3',
@@ -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->thread_id = $thread_id;
$upload->name = $filename;
@@ -169,11 +188,11 @@ class StorageController extends Controller {
$upload->size = $size;
$upload->poster = $disposition;
$upload->driver = $this->default;
$upload->path = $this->root. DIRECTORY_SEPARATOR.'attachments';
$upload->path = $this->root.DIRECTORY_SEPARATOR.'attachments';
if ($this->default !== 'database') {
$this->setFileSystem();
Storage::disk($this->default)->put($filename, $data);
$storagePath = Storage::disk($this->default)->getDriver()->getAdapter()->getPathPrefix() . $filename;
$storagePath = Storage::disk($this->default)->getDriver()->getAdapter()->getPathPrefix().$filename;
if (mime(\File::mimeType($storagePath)) != 'image' || mime(\File::extension($storagePath)) != 'image') {
chmod($storagePath, 1204);
}
@@ -185,23 +204,23 @@ class StorageController extends Controller {
}
}
public function saveAttachments($thread_id, $attachments = []) {
public function saveAttachments($thread_id, $attachments = [])
{
$disposition = 'ATTACHMENT';
$thread = '';
foreach ($attachments as $attachment) {
if (is_object($attachment)) {
if (method_exists($attachment, 'getStructure')) {
$structure = $attachment->getStructure();
if (isset($structure->disposition)) {
$disposition = $structure->disposition;
}
$filename = rand(1111, 9999) . "_" . $attachment->getFileName();
$filename = rand(1111, 9999).'_'.$attachment->getFileName();
$type = $attachment->getMimeType();
$size = $attachment->getSize();
$data = $attachment->getData();
} else {
$filename = rand(1111, 9999) . "_" . $attachment->getClientOriginalName();
$filename = rand(1111, 9999).'_'.$attachment->getClientOriginalName();
$type = $attachment->getMimeType();
$size = $attachment->getSize();
$data = file_get_contents($attachment->getRealPath());
@@ -210,10 +229,12 @@ class StorageController extends Controller {
$thread = $this->updateBody($attachment, $thread_id, $filename);
}
}
return $thread;
}
public function updateBody($attachment, $thread_id, $filename) {
public function updateBody($attachment, $thread_id, $filename)
{
$threads = new Ticket_Thread();
$thread = $threads->find($thread_id);
$disposition = 'ATTACHMENT';
@@ -230,22 +251,24 @@ class StorageController extends Controller {
$id = str_replace('>', '', str_replace('<', '', $structure->id));
$body = $thread->body;
// dd($id,$filename,$body);
$body = str_replace('cid:' . $id, $filename, $body);
$body = str_replace('cid:'.$id, $filename, $body);
// dd($body);
$thread->body = $body;
$thread->save();
}
return $thread;
}
public function getFile($drive, $name, $root) {
if ($drive != "database") {
$root = $root . DIRECTORY_SEPARATOR . $name;
public function getFile($drive, $name, $root)
{
if ($drive != 'database') {
$root = $root.DIRECTORY_SEPARATOR.$name;
if (\File::exists($root)) {
chmod($root, 0755);
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->delete();
$user = $user->whereId($id)->first();
try {
$error = Lang::get('lang.this_staff_is_related_to_some_tickets');
$user->id;
$user->delete();
throw new \Exception($error);
return redirect('agents')->with('success', Lang::get('lang.agent_deleted_sucessfully'));
} 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'));
}
}
try {
// fetching the database instance of the current email
$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'));
}
throw new Exception("Sorry we can't find your request");
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
@@ -125,6 +126,7 @@ class FormController extends Controller
'name.*' => 'required',
'type.*' => 'required',
]);
try {
$forms = new Forms();
$require = Input::get('required');
@@ -195,6 +197,7 @@ class FormController extends Controller
//dd($fields);
return view('themes.default1.admin.helpdesk.manage.form.edit', compact('form', 'fields', 'select_forms'));
}
throw new Exception("Sorry we can't find your request");
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
@@ -213,6 +216,7 @@ class FormController extends Controller
//dd($fields);
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");
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
@@ -227,6 +231,7 @@ class FormController extends Controller
'name.*' => 'required',
'type.*' => 'required',
]);
try {
if (!$request->input('formname')) {
throw new Exception(Lang::get('lang.please_fill_form_name'));
@@ -391,6 +396,7 @@ class FormController extends Controller
public function addChild($fieldid, Request $request)
{
$ids = $request->except('_token');
try {
foreach ($ids as $valueid => $formid) {
$field_value = new \App\Model\helpdesk\Form\FieldValue();

View File

@@ -172,7 +172,7 @@ class PriorityController extends Controller
public function destroy($priority_id)
{
$default_priority = Ticket_Priority::where('is_default', '>', '0')->first();
// dd($default_priority->is_default);
// dd($default_priority->is_default);
$topic = DB::table('help_topic')->where('priority', '=', $priority_id)->update(['priority' => $default_priority->is_default]);
// if ($topic > 0) {
// if ($topic > 1) {

View File

@@ -503,7 +503,7 @@ class SettingsController2 extends Controller
// try {
// /* fetch the values of access from access table */
// $accesses = $access->whereId('1')->first();
// // Direct to Access Settings Page
// // Direct to Access Settings Page
// return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
// } catch (Exception $e) {
// return view('404');

View File

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

View File

@@ -143,15 +143,15 @@ class TeamController extends Controller
{
// dd($request);
// $id = $request->input('show_id');
// $id = $request->input('show_id');
// dd($id);
// dd($id);
$users = DB::table('team_assign_agent')->select('team_assign_agent.id', 'team_assign_agent.team_id', 'users.user_name', 'users.first_name', 'users.last_name', 'users.active', 'users.assign_group', 'users.primary_dpt', 'users.role')
$users = DB::table('team_assign_agent')->select('team_assign_agent.id', 'team_assign_agent.team_id', 'users.user_name', 'users.first_name', 'users.last_name', 'users.active', 'users.assign_group', 'users.primary_dpt', 'users.role')
->join('users', 'users.id', '=', 'team_assign_agent.agent_id')
->where('team_assign_agent.team_id', '=', $id);
// ->get();
// dd($users);
// dd($users);
return \Datatable::query($users)
->showColumns('user_name')

View File

@@ -157,11 +157,11 @@ class TemplateController extends Controller
$fname = Input::get('folder_name');
$filename = $directory.$fname;
// images folder creation using php
// $mydir = dirname( __FILE__ )."/html/images";
// if(!is_dir($mydir)){
// mkdir("html/images");
// }
// images folder creation using php
// $mydir = dirname( __FILE__ )."/html/images";
// if(!is_dir($mydir)){
// mkdir("html/images");
// }
// Move all images files
if (!file_exists($filename)) {

View File

@@ -91,7 +91,7 @@ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n";
public function changeHttp()
{
//$string = "RewriteCond %{HTTPS} off
//RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n";
//RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n";
$string = '';
return $string;

View File

@@ -149,6 +149,7 @@ class WorkflowController extends Controller
$email_data["E-$key"] = $email;
}
$emails = $email_data;
try {
return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails'));
} 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\User;
use Auth;
use Crypt;
use DB;
use Exception;
use GeoIP;
// classes
use GeoIP;
use Hash;
use Illuminate\Http\Request;
use Illuminate\support\Collection;
@@ -49,7 +50,6 @@ use Lang;
use Mail;
use PDF;
use UTC;
use Crypt;
/**
* 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 = '')
{
\Event::fire('reply.request', [$request]);
try {
if (is_array($request->file('attachment'))) {
} else {
@@ -543,7 +544,7 @@ class TicketController extends Controller
'ticket_number' => $ticket_number,
'user' => $username,
'agent_sign' => $agentsign,
'system_link'=>$link
'system_link' => $link,
]
);
}
@@ -810,6 +811,7 @@ class TicketController extends Controller
}
// Event fire
\Event::fire(new \App\Events\ReadMailEvent($user_id, $password));
try {
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]);
@@ -854,7 +856,7 @@ class TicketController extends Controller
$template_variables = [
'agent_sign' => Auth::user()->agent_sign,
'ticket_number' => $ticket_number2,
'system_link'=>$link,
'system_link' => $link,
]);
}
} catch (\Exception $e) {
@@ -862,13 +864,14 @@ class TicketController extends Controller
}
} else {
$body2 = null;
try {
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'],
$template_variables = ['user' => $username,
'ticket_number' => $ticket_number2,
'department_sign' => '',
'system_link'=>$link,
'system_link' => $link,
]);
}
} catch (\Exception $e) {
@@ -1260,6 +1263,7 @@ class TicketController extends Controller
} else {
$from_email = $sending_emails->id;
}
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]);
} catch (\Exception $e) {
@@ -1496,6 +1500,7 @@ class TicketController extends Controller
$agent_email = $user_detail->email;
$ticket_link = route('ticket.thread', $id);
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
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]);
} catch (\Exception $e) {
@@ -1629,6 +1634,7 @@ class TicketController extends Controller
$create_user->password = Hash::make($password);
$create_user->save();
$user_id = $create_user->id;
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]);
} catch (\Exception $e) {
@@ -2316,6 +2322,7 @@ class TicketController extends Controller
$user->role = 'user';
if ($user->save()) {
$user_id = $user->id;
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]);
} catch (\Exception $e) {

View File

@@ -298,6 +298,7 @@ class UserController extends Controller
$password = $this->generateRandomString();
$user->password = Hash::make($password);
$user->role = 'user';
try {
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();
@@ -708,6 +709,7 @@ class UserController extends Controller
public function getProfile()
{
$user = Auth::user();
try {
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
} catch (Exception $e) {
@@ -727,6 +729,7 @@ class UserController extends Controller
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$status = $settings->status;
try {
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'))
->with(['phonecode' => $phonecode->phonecode,
@@ -769,7 +772,7 @@ class UserController extends Controller
// fetching upload destination path
$destinationPath = 'uploads/profilepic';
// 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
Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database
@@ -805,6 +808,7 @@ class UserController extends Controller
// checking if the old password matches the new password
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password'));
try {
$user->save();

View File

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

View File

@@ -61,6 +61,7 @@ class ApiController extends Controller
$this->middleware('jwt.auth');
$this->middleware('api', ['except' => 'GenerateApiKey']);
try {
$user = \JWTAuth::parseToken()->authenticate();
$this->user = $user;
@@ -1288,6 +1289,7 @@ class ApiController extends Controller
public function collaboratorSearch()
{
$this->validate($this->request, ['term' => 'required']);
try {
$emails = $this->ticket->autosearch();
//return $emails;

View File

@@ -329,12 +329,12 @@ class TicketController extends Controller
// Mail::send(array('html' => 'emails.ticket_re-reply'), ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $username, 'Agent_Signature' => $agentsign], function ($message) use ($email, $user_name, $ticket_number, $ticket_subject, $check_attachment) {
// $message->to($email, $user_name)->subject($ticket_subject . '[#' . $ticket_number . ']');
// // if(isset($attachments)){
// // if ($check_attachment == 1) {
// // $size = count($attach);
// // for ($i = 0; $i < $size; $i++) {
// // $message->attach($attachments[$i]->getRealPath(), ['as' => $attachments[$i]->getClientOriginalName(), 'mime' => $attachments[$i]->getClientOriginalExtension()]);
// // }
// // }
// // if ($check_attachment == 1) {
// // $size = count($attach);
// // for ($i = 0; $i < $size; $i++) {
// // $message->attach($attachments[$i]->getRealPath(), ['as' => $attachments[$i]->getClientOriginalName(), 'mime' => $attachments[$i]->getClientOriginalExtension()]);
// // }
// // }
// }, true);
//dd('reply');
/*
@@ -361,12 +361,12 @@ class TicketController extends Controller
}
// Mail::send('emails.ticket_re-reply', ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $collab_user_name, 'Agent_Signature' => $agentsign], function ($message) use ($collab_email, $collab_user_name, $ticket_number, $ticket_subject, $check_attachment) {
// $message->to($collab_email, $collab_user_name)->subject($ticket_subject . '[#' . $ticket_number . ']');
// // if ($check_attachment == 1) {
// // $size = sizeOf($attachments);
// // for ($i = 0; $i < $size; $i++) {
// // $message->attach($attachments[$i]->getRealPath(), ['as' => $attachments[$i]->getClientOriginalName(), 'mime' => $attachments[$i]->getClientOriginalExtension()]);
// // }
// // }
// // if ($check_attachment == 1) {
// // $size = sizeOf($attachments);
// // for ($i = 0; $i < $size; $i++) {
// // $message->attach($attachments[$i]->getRealPath(), ['as' => $attachments[$i]->getClientOriginalName(), 'mime' => $attachments[$i]->getClientOriginalExtension()]);
// // }
// // }
// }, true);
try {
@@ -713,6 +713,7 @@ class TicketController extends Controller
return $collab;
} catch (\Exception $ex) {
return $ex->getMessage();
throw new \Exception('get collaborator for ticket fails');
}
}

View File

@@ -47,7 +47,7 @@ class TokenAuthController extends Controller
$password = $request->input('password');
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
//$credentials = $request->only('email', 'password');
//$credentials = $request->only('email', 'password');
try {
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password, 'active'=>1])) {
@@ -62,7 +62,7 @@ class TokenAuthController extends Controller
}
$user_id = \Auth::user()->id;
// if no errors are encountered we can return a JWT
// if no errors are encountered we can return a JWT
return response()->json(compact('token', 'user_id'));
}
@@ -89,7 +89,7 @@ class TokenAuthController extends Controller
return response()->json(compact('error'));
}
//dd($user);
//dd($user);
return response()->json(compact('user'));
}

View File

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

View File

@@ -101,7 +101,7 @@ class GuestController extends Controller
// fetching upload destination path
$destinationPath = 'uploads/profilepic';
// 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
Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database
@@ -237,6 +237,7 @@ class GuestController extends Controller
//echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password'));
try {
$user->save();

View File

@@ -94,6 +94,7 @@ class UnAuthController extends Controller
$ticket_token->token = $hashed_token;
$ticket_token->save();
}
try {
$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)]
@@ -270,6 +271,7 @@ class UnAuthController extends Controller
} else {
$from_email = $sending_emails->id;
}
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]);
} catch (\Exception $e) {

View File

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

View File

@@ -120,6 +120,7 @@ class SettingsController extends Controller
$widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title;
$widget->value = $request->content;
try {
$widget->save();
@@ -198,6 +199,7 @@ class SettingsController extends Controller
$widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title;
$widget->value = $request->content;
try {
$widget->save();
@@ -234,6 +236,7 @@ class SettingsController extends Controller
$data->name = $request->input('name');
$data->email = $request->input('email');
$data->password = Crypt::encrypt($request->input('password'));
try {
$data->save();
@@ -257,6 +260,7 @@ class SettingsController extends Controller
$pass = $request->input('password');
$password = Crypt::encrypt($pass);
$settings->password = $password;
try {
$settings->save();
} catch (Exception $e) {
@@ -270,6 +274,7 @@ class SettingsController extends Controller
$settings->logo = $fileName;
$settings->save();
}
try {
$settings->fill($request->except('logo', 'password'))->save();
@@ -364,6 +369,7 @@ class SettingsController extends Controller
public function PostPlugins(Request $request)
{
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
try {
if (!extension_loaded('zip')) {
throw new Exception('Please enable zip extension in your php');

View File

@@ -364,7 +364,7 @@ class InstallController extends Controller
$datacontent = File::get($install);
$datacontent = str_replace('%0%', $value, $datacontent);
File::put($install, $datacontent);
// setting email settings in route
// setting email settings in route
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
$link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
@@ -375,6 +375,7 @@ class InstallController extends Controller
$datacontent2 = str_replace('http://localhost', $link, $datacontent2);
File::put($app_url, $datacontent2);
$language = Cache::get('language');
try {
Cache::flush();

View File

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

View File

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

View File

@@ -29,6 +29,7 @@ class TicketRequest extends Request
public function rules()
{
$error = '';
try {
$size = $this->size();
if ($size > 800 || $size == 0) {

View File

@@ -494,11 +494,11 @@ Route::group(['middleware' => ['web']], function () {
Route::get('check_ticket/{id}', ['as' => 'check_ticket', 'uses' => 'Client\helpdesk\GuestController@get_ticket_email']); //detail ticket information
// show ticket via have a ticket
// show ticket via have a ticket
Route::get('show-ticket/{id}/{code}', ['as' => 'show.ticket', 'uses' => 'Client\helpdesk\UnAuthController@showTicketCode']); //detail ticket information
//testing ckeditor
//===================================================================================
//===================================================================================
Route::group(['middleware' => 'role.user', 'middleware' => 'auth'], function () {
Route::get('client-profile', ['as' => 'client.profile', 'uses' => 'Client\helpdesk\GuestController@getProfile']); /* User profile get */
@@ -511,7 +511,7 @@ Route::group(['middleware' => ['web']], function () {
Route::post('verify-client-number2', ['as' => 'post-client-verify-number', 'uses' => 'Client\helpdesk\GuestController@verifyOTP']);
});
//====================================================================================
//====================================================================================
Route::get('checkticket', 'Client\helpdesk\ClientTicketController@getCheckTicket'); /* Check your Ticket */
Route::get('myticket', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@getMyticket']); /* Get my tickets */
Route::get('myticket/{id}', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@thread']); /* Get my tickets */

View File

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

View File

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

View File

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