update v1.0.7.9 R.C.

This is a Release Candidate. We are still testing.
This commit is contained in:
Sujit Prasad
2016-08-03 20:04:36 +05:30
parent 8b6b924d09
commit ffa56a43cb
3830 changed files with 181529 additions and 495353 deletions

19
.gitignore vendored
View File

@@ -1,7 +1,18 @@
/node_modules # Please try and keep this file organized by alphabetical order. Single files first, then directories.
.env
example.env
Homestead.yaml Homestead.yaml
Homestead.json Homestead.json
/nbproject/private/
.env
/app/Plugins/ServiceDesk/
/app/config/ /app/config/
/app/Plugins/Reseller/
/app/Plugins/
/app/Plugins/ServiceDesk/
/config/app.php
/config/database.php
/config/lfm.php
/nbproject/private/
/node_modules
/public/error_log
/public/lb-faveo/media/
/public/uploads
/public/photos/

20
.htaccess Normal file
View File

@@ -0,0 +1,20 @@
# Very simple security for apache webserver - do not remove.
#
# Restrict access to DotFiles (like .htaccess, .env, .gitignore....)
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>
# Restrict access to system files
<FilesMatch "^(composer.json|composer.lock|artisan|code_of_conduct.md|gulpfile.js|package.json|error_log|phpspec.yml|example.env)">
Order allow,deny
Deny from all
</FilesMatch>
# Uncomment to restrict access to release text files
#<FilesMatch "^(LICENSE|README.md|readme.txt|release-notes.txt)">
# Order allow,deny
# Deny from all
#</FilesMatch>

View File

@@ -1,3 +1,9 @@
|======================================
|Updating from 1.0.7.8 to 1.0.7.9
|======================================
Wait till the official release.
|====================================== |======================================
|Updating from 1.0.7.4 to 1.0.7.5 |Updating from 1.0.7.4 to 1.0.7.5
|====================================== |======================================

View File

@@ -112,7 +112,9 @@ CREATE TABLE IF NOT EXISTS `common_settings` (
-- --
INSERT INTO `common_settings` (`id`, `option_name`, `option_value`, `status`, `optional_field`, `created_at`, `updated_at`) VALUES INSERT INTO `common_settings` (`id`, `option_name`, `option_value`, `status`, `optional_field`, `created_at`, `updated_at`) VALUES
(1, 'ticket_token_time_duration', '1', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'); (1, 'ticket_token_time_duration', '1', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'),
(2, 'enable_rtl', '', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'),
(3, 'user_set_ticket_status', '',1,'','2016-06-14 09:07:17','2016-06-14 09:07:17');
-- -------------------------------------------------------- -- --------------------------------------------------------
@@ -885,7 +887,6 @@ INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2016_02_16_140450_create_organization_table', 1), ('2016_02_16_140450_create_organization_table', 1),
('2016_02_16_140450_create_password_resets_table', 1), ('2016_02_16_140450_create_password_resets_table', 1),
('2016_02_16_140450_create_plugins_table', 1), ('2016_02_16_140450_create_plugins_table', 1),
('2016_02_16_140450_create_send_mail_table', 1),
('2016_02_16_140450_create_settings_alert_notice_table', 1), ('2016_02_16_140450_create_settings_alert_notice_table', 1),
('2016_02_16_140450_create_settings_auto_response_table', 1), ('2016_02_16_140450_create_settings_auto_response_table', 1),
('2016_02_16_140450_create_settings_company_table', 1), ('2016_02_16_140450_create_settings_company_table', 1),
@@ -1094,31 +1095,6 @@ CREATE TABLE IF NOT EXISTS `rating_ref` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `send_mail`
--
CREATE TABLE IF NOT EXISTS `send_mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`driver` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`host` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`port` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`encryption` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
--
-- Dumping data for table `send_mail`
--
INSERT INTO `send_mail` (`id`, `driver`, `host`, `port`, `encryption`, `name`, `email`, `password`) VALUES
(1, '', '', '', '', '', '', '');
-- --------------------------------------------------------
-- --
-- Table structure for table `settings_alert_notice` -- Table structure for table `settings_alert_notice`
-- --
@@ -1335,7 +1311,7 @@ CREATE TABLE IF NOT EXISTS `settings_system` (
-- --
INSERT INTO `settings_system` (`id`, `status`, `url`, `name`, `department`, `page_size`, `log_level`, `purge_log`, `api_enable`, `api_key_mandatory`, `api_key`, `name_format`, `time_farmat`, `date_format`, `date_time_format`, `day_date_time`, `time_zone`, `content`, `version`, `created_at`, `updated_at`) VALUES INSERT INTO `settings_system` (`id`, `status`, `url`, `name`, `department`, `page_size`, `log_level`, `purge_log`, `api_enable`, `api_key_mandatory`, `api_key`, `name_format`, `time_farmat`, `date_format`, `date_time_format`, `day_date_time`, `time_zone`, `content`, `version`, `created_at`, `updated_at`) VALUES
(1, 1, '', '<b>ABC</b> SUPPORT CENTER', '1', '', '', '', 0, 0, '', '', NULL, NULL, 1, '', 79, '', '1.0.7.7', '2016-06-14 09:07:18', '2016-06-14 09:10:38'); (1, 1, '', '<b>ABC</b> SUPPORT CENTER', '1', '', '', '', 0, 0, '', '', NULL, NULL, 1, '', 79, '', '', '2016-06-14 09:07:18', '2016-06-14 09:10:38');
-- -------------------------------------------------------- -- --------------------------------------------------------

View File

@@ -112,7 +112,9 @@ CREATE TABLE IF NOT EXISTS `common_settings` (
-- --
INSERT INTO `common_settings` (`id`, `option_name`, `option_value`, `status`, `optional_field`, `created_at`, `updated_at`) VALUES INSERT INTO `common_settings` (`id`, `option_name`, `option_value`, `status`, `optional_field`, `created_at`, `updated_at`) VALUES
(1, 'ticket_token_time_duration', '1', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'); (1, 'ticket_token_time_duration', '1', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'),
(2, 'enable_rtl', '', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'),
(3, 'user_set_ticket_status', '',1,'','2016-06-14 09:07:17','2016-06-14 09:07:17');
-- -------------------------------------------------------- -- --------------------------------------------------------
@@ -885,7 +887,6 @@ INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2016_02_16_140450_create_organization_table', 1), ('2016_02_16_140450_create_organization_table', 1),
('2016_02_16_140450_create_password_resets_table', 1), ('2016_02_16_140450_create_password_resets_table', 1),
('2016_02_16_140450_create_plugins_table', 1), ('2016_02_16_140450_create_plugins_table', 1),
('2016_02_16_140450_create_send_mail_table', 1),
('2016_02_16_140450_create_settings_alert_notice_table', 1), ('2016_02_16_140450_create_settings_alert_notice_table', 1),
('2016_02_16_140450_create_settings_auto_response_table', 1), ('2016_02_16_140450_create_settings_auto_response_table', 1),
('2016_02_16_140450_create_settings_company_table', 1), ('2016_02_16_140450_create_settings_company_table', 1),
@@ -1094,31 +1095,6 @@ CREATE TABLE IF NOT EXISTS `rating_ref` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `send_mail`
--
CREATE TABLE IF NOT EXISTS `send_mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`driver` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`host` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`port` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`encryption` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
--
-- Dumping data for table `send_mail`
--
INSERT INTO `send_mail` (`id`, `driver`, `host`, `port`, `encryption`, `name`, `email`, `password`) VALUES
(1, '', '', '', '', '', '', '');
-- --------------------------------------------------------
-- --
-- Table structure for table `settings_alert_notice` -- Table structure for table `settings_alert_notice`
-- --
@@ -1335,7 +1311,7 @@ CREATE TABLE IF NOT EXISTS `settings_system` (
-- --
INSERT INTO `settings_system` (`id`, `status`, `url`, `name`, `department`, `page_size`, `log_level`, `purge_log`, `api_enable`, `api_key_mandatory`, `api_key`, `name_format`, `time_farmat`, `date_format`, `date_time_format`, `day_date_time`, `time_zone`, `content`, `version`, `created_at`, `updated_at`) VALUES INSERT INTO `settings_system` (`id`, `status`, `url`, `name`, `department`, `page_size`, `log_level`, `purge_log`, `api_enable`, `api_key_mandatory`, `api_key`, `name_format`, `time_farmat`, `date_format`, `date_time_format`, `day_date_time`, `time_zone`, `content`, `version`, `created_at`, `updated_at`) VALUES
(1, 1, '', '<b>ABC</b> SUPPORT CENTER', '1', '', '', '', 0, 0, '', '', NULL, NULL, 1, '', 79, '', '1.0.7.7', '2016-06-14 09:07:18', '2016-06-14 09:10:38'); (1, 1, '', '<b>ABC</b> SUPPORT CENTER', '1', '', '', '', 0, 0, '', '', NULL, NULL, 1, '', 79, '', '', '2016-06-14 09:07:18', '2016-06-14 09:10:38');
-- -------------------------------------------------------- -- --------------------------------------------------------

View File

@@ -0,0 +1,8 @@
-- ----------------------------------------------------------
--
-- Alter Table structure for table `common_settings`
--
INSERT INTO `common_settings` (`id`, `option_name`, `option_value`, `status`, `optional_field`, `created_at`, `updated_at`) VALUES (2, 'enable_rtl', '', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'),(3, 'user_set_ticket_status', '',1,'','2016-06-14 09:07:17','2016-06-14 09:07:17');
-- Wait till the official release

View File

@@ -23,7 +23,8 @@ class BaseModel extends Model
File::makeDirectory($path, $mode = 0777, true, true); File::makeDirectory($path, $mode = 0777, true, true);
} }
$config = \HTMLPurifier_Config::createDefault(); $config = \HTMLPurifier_Config::createDefault();
//dd($config); $config->set('HTML.Trusted', true);
$config->set('Filter.YouTube', true);
$purifier = new \HTMLPurifier($config); $purifier = new \HTMLPurifier($config);
if ($value != strip_tags($value)) { if ($value != strip_tags($value)) {
$value = $purifier->purify($value); $value = $purifier->purify($value);

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\Agent\helpdesk\NotificationController;
use App\Http\Controllers\Common\PhpMailController;
use Exception;
class SendReport extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'report:send';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sending the report mail ';
protected $report;
protected $mail;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
$mail = new PhpMailController();
$report = new NotificationController($mail);
$this->report = $report;
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
try {
$this->report->send_notification();
\Log::info("Report has send");
$this->info("Report has send");
} catch (Exception $ex) {
dd($ex);
$this->error($ex->getMessage());
}
}
}

View File

@@ -1,7 +1,5 @@
<?php <?php
namespace App\Exceptions; namespace App\Exceptions;
// controller // controller
use Bugsnag; use Bugsnag;
//use Illuminate\Validation\ValidationException; //use Illuminate\Validation\ValidationException;
@@ -13,7 +11,6 @@ use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Validation\ValidationException; use Illuminate\Foundation\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
/** /**
@@ -23,26 +20,13 @@ class Handler extends ExceptionHandler
*/ */
protected $dontReport = [ protected $dontReport = [
// 'Symfony\Component\HttpKernel\Exception\HttpException', // 'Symfony\Component\HttpKernel\Exception\HttpException',
Illuminate\Http\Exception\HttpResponseException::class, \Illuminate\Http\Exception\HttpResponseException::class,
ValidationException::class, ValidationException::class,
AuthorizationException::class, AuthorizationException::class,
HttpResponseException ::class, HttpResponseException ::class,
ModelNotFoundException::class, ModelNotFoundException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class, \Symfony\Component\HttpKernel\Exception\HttpException::class,
]; ];
/**
* Create a new controller instance.
* constructor to check
* 1. php mailer.
*
* @return void
*/
// public function __construct(PhpMailController $PhpMailController)
// {
// $this->PhpMailController = $PhpMailController;
// }
/** /**
* Report or log an exception. * Report or log an exception.
* *
@@ -60,73 +44,12 @@ class Handler extends ExceptionHandler
Bugsnag::setBeforeNotifyFunction(function ($error) { Bugsnag::setBeforeNotifyFunction(function ($error) {
return false; return false;
}); });
} else {
$version = \Config::get('app.version');
Bugsnag::setAppVersion($version);
} }
return parent::report($e); return parent::report($e);
} }
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
*
* @return \Illuminate\Http\Response
*/
// public function render($request, Exception $e) {
// if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
// } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
// }
// This is to check if the debug is true or false
// if (config('app.debug') == false) {
// // checking if the error is actually an error page or if its an system error page
// if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
// return response()->view('errors.404', []);
// } else {
// // checking if the application is installed
// if (\Config::get('database.install') == 1) {
// // checking if the error log send to Ladybirdweb is enabled or not
// if (\Config::get('app.ErrorLog') == '1') {
//
// }
// }
// return response()->view('errors.500', []);
// }
// }
// returns non oops error message
// return parent::render($request, $e);
// checking if the error is related to http error i.e. page not found
// if ($this->isHttpException($e)) {
// // returns error for page not found
// return $this->renderHttpException($e);
// }
// // checking if the config app sebug is enabled or not
// if (config('app.debug')) {
// // returns oops error page i.e. colour full error page
// return $this->renderExceptionWithWhoops($e);
// }
//return parent::render($request, $e);
// }
/**
* function to generate oops error page.
*
* @param \Exception $e
*
* @return \Illuminate\Http\Response
*/
// protected function renderExceptionWithWhoops(Exception $e) {
// // new instance of whoops class to display customized error page
// $whoops = new \Whoops\Run();
// $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
//
// return new \Illuminate\Http\Response(
// $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()
// );
// }
/** /**
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
@@ -148,7 +71,6 @@ class Handler extends ExceptionHandler
return $this->common($request, $e); return $this->common($request, $e);
} }
} }
/** /**
* Function to render 500 error page. * Function to render 500 error page.
* *
@@ -162,10 +84,9 @@ class Handler extends ExceptionHandler
if (config('app.debug') == true) { if (config('app.debug') == true) {
return parent::render($request, $e); return parent::render($request, $e);
} }
return response()->view('errors.500');
return redirect()->route('error500', []); //return redirect()->route('error500', []);
} }
/** /**
* Function to render 404 error page. * Function to render 404 error page.
* *
@@ -176,13 +97,38 @@ class Handler extends ExceptionHandler
*/ */
public function render404($request, $e) public function render404($request, $e)
{ {
$seg = $request->segments();
if (in_array('api', $seg)) {
return response()->json(['status' => '404']);
}
if (config('app.debug') == true) {
if($e->getStatusCode() == '404') {
return redirect()->route('error404', []);
}
return parent::render($request, $e);
}
return redirect()->route('error404', []);
}
/**
* Function to render database connection failed
*
* @param type $request
* @param type $e
*
* @return type mixed
*/
public function renderDB($request, $e)
{
$seg = $request->segments();
if (in_array('api', $seg)) {
return response()->json(['status' => '404']);
}
if (config('app.debug') == true) { if (config('app.debug') == true) {
return parent::render($request, $e); return parent::render($request, $e);
} }
return redirect()->route('error404', []); return redirect()->route('error404', []);
} }
/** /**
* Common finction to render both types of codes. * Common finction to render both types of codes.
* *
@@ -198,10 +144,21 @@ class Handler extends ExceptionHandler
return $this->render404($request, $e); return $this->render404($request, $e);
case $e instanceof NotFoundHttpException: case $e instanceof NotFoundHttpException:
return $this->render404($request, $e); return $this->render404($request, $e);
case $e instanceof PDOException:
if(strpos('1045', $e->getMessage()) == true) {
return $this->renderDB($request, $e);
} else {
return $this->render500($request, $e);
}
// case $e instanceof ErrorException:
// if($e->getMessage() == 'Breadcrumb not found with name "" ') {
// return $this->render404($request, $e);
// } else {
// return parent::render($request, $e);
// }
default: default:
return $this->render500($request, $e); return $this->render500($request, $e);
} }
return parent::render($request, $e); return parent::render($request, $e);
} }
} }

View File

@@ -3,8 +3,8 @@
namespace App\Http\Controllers\Admin\helpdesk; namespace App\Http\Controllers\Admin\helpdesk;
// controller // controller
use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\PhpMailController;
// request // request
use App\Http\Requests\helpdesk\AgentRequest; use App\Http\Requests\helpdesk\AgentRequest;
use App\Http\Requests\helpdesk\AgentUpdate; use App\Http\Requests\helpdesk\AgentUpdate;
@@ -139,12 +139,14 @@ class AgentController extends Controller
// fetch user credentails to send mail // fetch user credentails to send mail
$name = $user->user_name; $name = $user->user_name;
$email = $user->email; $email = $user->email;
try { if($request->input('send_email')) {
// send mail on registration try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); // send mail on registration
} catch (Exception $e) { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
// returns if try fails } catch (Exception $e) {
return redirect('agents')->with('warning', Lang::get('lang.agent_send_mail_error_on_agent_creation')); // returns if try fails
return redirect('agents')->with('warning', Lang::get('lang.agent_send_mail_error_on_agent_creation'));
}
} }
// returns for the success case // returns for the success case
return redirect('agents')->with('success', Lang::get('lang.agent_creation_success')); return redirect('agents')->with('success', Lang::get('lang.agent_creation_success'));

View File

@@ -54,7 +54,7 @@ class CloseWrokflowController extends Controller
$security = new WorkflowClose(); $security = new WorkflowClose();
$securitys = $security->whereId($id)->first(); $securitys = $security->whereId($id)->first();
$securitys->days = $request->input('days'); $securitys->days = $request->input('days');
// $securitys->condition = $request->input('condition'); // $securitys->condition = $request->input('condition');
$securitys->send_email = $request->input('send_email'); $securitys->send_email = $request->input('send_email');
$securitys->status = $request->input('status'); $securitys->status = $request->input('status');
$securitys->save(); $securitys->save();

View File

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

View File

@@ -498,7 +498,7 @@ class EmailsController extends Controller
$mailbox_protocol = $fetching_encryption2; $mailbox_protocol = $fetching_encryption2;
$host = $request->input('fetching_host'); $host = $request->input('fetching_host');
$port = $request->input('fetching_port'); $port = $request->input('fetching_port');
$mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX'; $mailbox = '{'.$host.':'.$port.$fetching_protocol.$mailbox_protocol.'}INBOX';
} else { } else {
$mailbox_protocol = $fetching_protocol.$fetching_encryption; $mailbox_protocol = $fetching_protocol.$fetching_encryption;
$host = $request->input('fetching_host'); $host = $request->input('fetching_host');

View File

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

View File

@@ -40,7 +40,7 @@ class HelptopicController extends Controller
} }
/** /**
* Display a listing of the resource. * Display a listing of the helptopic.
* *
* @param type Help_topic $topic * @param type Help_topic $topic
* *
@@ -58,7 +58,7 @@ class HelptopicController extends Controller
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new helptopic.
* *
* @param type Priority $priority * @param type Priority $priority
* @param type Department $department * @param type Department $department
@@ -96,7 +96,7 @@ class HelptopicController extends Controller
} }
/** /**
* Store a newly created resource in storage. * Store a newly created helptpoic in storage.
* *
* @param type Help_topic $topic * @param type Help_topic $topic
* @param type HelptopicRequest $request * @param type HelptopicRequest $request
@@ -128,7 +128,7 @@ class HelptopicController extends Controller
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified helptopic.
* *
* @param type $id * @param type $id
* @param type Priority $priority * @param type Priority $priority
@@ -160,7 +160,7 @@ class HelptopicController extends Controller
} }
/** /**
* Update the specified resource in storage. * Update the specified helptopic in storage.
* *
* @param type $id * @param type $id
* @param type Help_topic $topic * @param type Help_topic $topic
@@ -201,7 +201,7 @@ class HelptopicController extends Controller
} }
/** /**
* Remove the specified resource from storage. * Remove the specified helptopic from storage.
* *
* @param type int $id * @param type int $id
* @param type Help_topic $topic * @param type Help_topic $topic

View File

@@ -98,7 +98,12 @@ class LanguageController extends Controller
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..' $values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
return \Datatable::collection(new Collection($values)) return \Datatable::collection(new Collection($values))
->addColumn('language', function ($model) { ->addColumn('language', function ($model) {
return Config::get('languages.'.$model); if ($model == Config::get('app.fallback_locale')) {
return Config::get('languages.'.$model).' ('.Lang::get('lang.default').')';
} else {
return Config::get('languages.'.$model);
}
}) })
->addColumn('id', function ($model) { ->addColumn('id', function ($model) {
return $model; return $model;
@@ -228,24 +233,29 @@ class LanguageController extends Controller
public function deleteLanguage($lang) public function deleteLanguage($lang)
{ {
if ($lang !== App::getLocale()) { if ($lang !== App::getLocale()) {
$deletePath = base_path('resources/lang').'/'.$lang; //define file path to delete if ($lang !== Config::get('app.fallback_locale')) {
$success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang $deletePath = base_path('resources/lang').'/'.$lang; //define file path to delete
if ($success) { $success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang
//sending back with success message if ($success) {
Session::flash('success', Lang::get('lang.delete-success')); //sending back with success message
Session::flash('success', Lang::get('lang.delete-success'));
return Redirect::back();
return Redirect::back();
} else {
//sending back with error message
Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
return Redirect::back();
}
} else { } else {
//sending back with error message Session::flash('fails', Lang::get('lang.lang-fallback-lang'));
Session::flash('fails', Lang::get('lang.lang-doesnot-exist')); return redirect('languages');
return Redirect::back();
} }
} else { } else {
//sending back with error message
Session::flash('fails', Lang::get('lang.active-lang-error')); Session::flash('fails', Lang::get('lang.active-lang-error'));
return redirect('languages'); return redirect('languages');
} }
} }
} }

View File

@@ -64,10 +64,10 @@ class SecurityController extends Controller
* *
* @return Response * @return Response
*/ */
public function show($id) // public function show($id)
{ // {
return view('themes.default1.admin.helpdesk.setting.security.preview', compact('id')); // return view('themes.default1.admin.helpdesk.setting.security.preview', compact('id'));
} // }
/** /**
* Update security details. * Update security details.

View File

@@ -30,6 +30,7 @@ use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Time_format;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Workflow\WorkflowClose; use App\Model\helpdesk\Workflow\WorkflowClose;
use App\Model\helpdesk\Settings\CommonSettings;
use DateTime; use DateTime;
// classes // classes
use DB; use DB;
@@ -93,7 +94,7 @@ class SettingsController extends Controller
$companys = $company->whereId('1')->first(); $companys = $company->whereId('1')->first();
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'lb-faveo/media/company/'; $destinationPath = 'uploads/company/';
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999).'.'.$name;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$companys->logo = $fileName; $companys->logo = $fileName;
@@ -145,7 +146,7 @@ class SettingsController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time, CommonSettings $common_settings)
{ {
try { try {
/* fetch the values of system from system table */ /* fetch the values of system from system table */
@@ -154,11 +155,11 @@ class SettingsController extends Controller
$departments = $department->get(); $departments = $department->get();
/* Fetch the values from Timezones table */ /* Fetch the values from Timezones table */
$timezones = $timezone->get(); $timezones = $timezone->get();
/* Fetch status value of common settings */
//$debug = \Config::get('app.debug'); $common_setting = $common_settings->select('status')->where('option_name', '=', 'user_set_ticket_status')->first();
//dd($value); // /dd($common_setting);
/* Direct to System Settings Page */ /* Direct to System Settings Page */
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time')); return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time', 'common_setting'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
@@ -176,16 +177,26 @@ class SettingsController extends Controller
public function postsystem($id, System $system, SystemRequest $request) public function postsystem($id, System $system, SystemRequest $request)
{ {
try { try {
// dd($request); //dd($request->user_set_ticket_status);
/* fetch the values of system request */ /* fetch the values of system request */
$systems = $system->whereId('1')->first(); $systems = $system->whereId('1')->first();
/* fill the values to coompany table */ /* fill the values to coompany table */
/* Check whether function success or not */ /* Check whether function success or not */
$systems->fill($request->input())->save(); $systems->fill($request->input())->save();
/* redirect to Index page with Success Message */ $rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if($request->enable_rtl != null) {
$rtl->option_value = 1;
} else {
$rtl->option_value = 0;
}
$rtl->save();
// dd($datacontent); $usts = CommonSettings::where('option_name', '=', 'user_set_ticket_status')->first();
//\Config::set('app.debug', $request->input('debug')); if ($usts->status != $request->user_set_ticket_status){
$usts->status = $request->user_set_ticket_status;
$usts->save();
}
/* redirect to Index page with Success Message */
return redirect('getsystem')->with('success', Lang::get('lang.system_updated_successfully')); return redirect('getsystem')->with('success', Lang::get('lang.system_updated_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
@@ -220,7 +231,7 @@ class SettingsController extends Controller
} }
/** /**
* Update the specified resource in storage. * Update the specified Ticket in storage.
* *
* @param type int $id * @param type int $id
* @param type Ticket $ticket * @param type Ticket $ticket
@@ -280,7 +291,7 @@ class SettingsController extends Controller
} }
/** /**
* Update the specified resource in storage. * Update the specified email setting in storage.
* *
* @param type int $id * @param type int $id
* @param type Email $email * @param type Email $email
@@ -339,7 +350,7 @@ class SettingsController extends Controller
} }
/** /**
* Update the specified resource in storage for cron job. * Update the specified schedular in storage for cron job.
* *
* @param type Email $email * @param type Email $email
* @param type EmailRequest $request * @param type EmailRequest $request
@@ -399,7 +410,7 @@ class SettingsController extends Controller
} }
/** /**
* Update the specified resource in storage. * Update the specified autoresponse in storage.
* *
* @param type Responder $responder * @param type Responder $responder
* @param type Request $request * @param type Request $request
@@ -448,7 +459,7 @@ class SettingsController extends Controller
} }
/** /**
* Update the specified resource in storage. * Update the specified alert in storage.
* *
* @param type $id * @param type $id
* @param type Alert $alert * @param type Alert $alert

View File

@@ -221,7 +221,7 @@ class SettingsController2 extends Controller
$companys = $company->whereId('1')->first(); $companys = $company->whereId('1')->first();
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'lb-faveo/media/company/'; $destinationPath = 'uploads/company/';
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999).'.'.$name;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$companys->logo = $fileName; $companys->logo = $fileName;

View File

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

View File

@@ -6,7 +6,7 @@ namespace App\Http\Controllers\Admin\helpdesk;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// models // models
use App\Model\helpdesk\Priority; use App\Model\helpdesk\Priority;
use App\Model\helpdesk\Ticket_thread; use App\Model\helpdesk\Ticket_Thread;
// classes // classes
use Exception; use Exception;
@@ -25,7 +25,7 @@ class ThreadController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function getTickets(Ticket_thread $thread, Priority $priority) public function getTickets(Ticket_Thread $thread, Priority $priority)
{ {
try { try {
/* get the values of Ticket_thread from Ticket_thread Table */ /* get the values of Ticket_thread from Ticket_thread Table */

View File

@@ -132,7 +132,7 @@ class WorkflowController extends Controller
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
$confirmation = 'Are you sure?'; $confirmation = 'Are you sure?';
return "<a class='btn btn-info btn-xs btn-flat' href='".route('workflow.edit', $model->id)."'><i class='fa fa-edit text-black'></i> Edit</a> <a class='btn btn-danger btn-xs btn-flat' href='".route('workflow.delete', $model->id)."'><i class='fa fa-trash text-black'></i> Delete</a>"; return "<a class='btn btn-info btn-xs btn-flat' href='".route('workflow.edit', $model->id)."'><i class='fa fa-edit text-black'></i> Edit</a> <a class='btn btn-danger btn-xs btn-flat' href='".route('workflow.delete', $model->id)."' onclick='return confirm_delete()'><i class='fa fa-trash text-black'></i> Delete</a> ";
}) })
->make(); ->make();
} }

View File

@@ -27,16 +27,15 @@ use PhpImap\Mailbox as ImapMailbox;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class MailController extends Controller class MailController extends Controller {
{
/** /**
* constructor * constructor
* Create a new controller instance. * Create a new controller instance.
* *
* @param type TicketController $TicketController * @param type TicketController $TicketController
*/ */
public function __construct(TicketWorkflowController $TicketWorkflowController) public function __construct(TicketWorkflowController $TicketWorkflowController) {
{
$this->middleware('board'); $this->middleware('board');
$this->TicketWorkflowController = $TicketWorkflowController; $this->TicketWorkflowController = $TicketWorkflowController;
} }
@@ -46,13 +45,12 @@ class MailController extends Controller
* *
* @return type * @return type
*/ */
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) {
{
// $path_url = $system->first()->url; // $path_url = $system->first()->url;
if ($settings_email->first()->email_fetching == 1) { if ($settings_email->first()->email_fetching == 1) {
if ($settings_email->first()->all_emails == 1) { if ($settings_email->first()->all_emails == 1) {
// $helptopic = $this->TicketController->default_helptopic(); // $helptopic = $this->TicketController->default_helptopic();
// $sla = $this->TicketController->default_sla(); // $sla = $this->TicketController->default_sla();
$email = $emails->get(); $email = $emails->get();
foreach ($email as $e_mail) { foreach ($email as $e_mail) {
if ($e_mail->fetching_status == 1) { if ($e_mail->fetching_status == 1) {
@@ -82,7 +80,7 @@ class MailController extends Controller
$protocol = $fetching_encryption2; $protocol = $fetching_encryption2;
} else { } else {
if ($e_mail->fetching_protocol) { if ($e_mail->fetching_protocol) {
$fetching_protocol = '/'.$e_mail->fetching_protocol; $fetching_protocol = '/' . $e_mail->fetching_protocol;
} else { } else {
$fetching_protocol = ''; $fetching_protocol = '';
} }
@@ -91,21 +89,38 @@ class MailController extends Controller
} else { } else {
$fetching_encryption = ''; $fetching_encryption = '';
} }
$protocol = $fetching_protocol.$fetching_encryption; $protocol = $fetching_protocol . $fetching_encryption;
} }
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX'; $imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX';
$password = Crypt::decrypt($e_mail->password); $password = Crypt::decrypt($e_mail->password);
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); try {
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
} catch (\PhpImap\Exception $e) {
echo "Connection error";
}
$mails = []; $mails = [];
$mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day'))); try {
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime('-1 day')));
} catch (\PhpImap\Exception $e) {
echo "Connection error";
}
if (!$mailsIds) { if (!$mailsIds) {
die('Mailbox is empty'); die('Mailbox is empty');
} }
foreach ($mailsIds as $mailId) { foreach ($mailsIds as $mailId) {
$overview = $mailbox->get_overview($mailId); try {
$overview = $mailbox->get_overview($mailId);
} catch (Exception $e) {
return \Lang::get('lang.unable_to_fetch_emails');
}
$var = $overview[0]->seen ? 'read' : 'unread'; $var = $overview[0]->seen ? 'read' : 'unread';
if ($var == 'unread') { if ($var == 'unread') {
$mail = $mailbox->getMail($mailId); $mail = $mailbox->getMail($mailId);
try {
$mail = $mailbox->getMail($mailId);
} catch (\PhpImap\Exception $e) {
echo "Connection error";
}
if ($settings_email->first()->email_collaborator == 1) { if ($settings_email->first()->email_collaborator == 1) {
$collaborator = $mail->cc; $collaborator = $mail->cc;
} else { } else {
@@ -121,14 +136,24 @@ class MailController extends Controller
} }
if ($body == null) { if ($body == null) {
$attach = $mail->getAttachments(); $attach = $mail->getAttachments();
$path = $attach['html-body']->filePath; if (is_array($attach)) {
if ($path == null) { if (key_exists('html-body', $attach)) {
$path = $attach['text-body']->filePath; $path = $attach['html-body']->filePath;
}
if ($path == null) {
if (key_exists('text-body', $attach)) {
$path = $attach['text-body']->filePath;
}
}
if ($path) {
$body = file_get_contents($path);
}
if ($body) {
$body = self::trimTableTag($body);
} else {
$body = "";
}
} }
$body = file_get_contents($path);
//dd($body);
$body = self::trimTableTag($body);
} }
// if ($body == null) { // if ($body == null) {
// $body = $mailbox->backup_getmail($mailId); // $body = $mailbox->backup_getmail($mailId);
@@ -137,10 +162,10 @@ class MailController extends Controller
$date = $mail->date; $date = $mail->date;
$datetime = $overview[0]->date; $datetime = $overview[0]->date;
$date_time = explode(' ', $datetime); $date_time = explode(' ', $datetime);
$date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4]; $date = $date_time[1] . '-' . $date_time[2] . '-' . $date_time[3] . ' ' . $date_time[4];
$date = date('Y-m-d H:i:s', strtotime($date)); $date = date('Y-m-d H:i:s', strtotime($date));
if (isset($mail->subject)) { if (isset($mail->subject)) {
$subject = utf8_decode($mail->subject); $subject = $mail->subject;
} else { } else {
$subject = 'No Subject'; $subject = 'No Subject';
} }
@@ -156,57 +181,57 @@ class MailController extends Controller
$team_assign = null; $team_assign = null;
$ticket_status = null; $ticket_status = null;
$result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response); $result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
// dd($result);
if ($result[1] == true) { if ($result[1] == true) {
$ticket_table = Tickets::where('ticket_number', '=', $result[0])->first(); $ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();
$thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id'); $thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id');
// $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
$thread_id = $thread_id; $thread_id = $thread_id;
foreach ($mail->getAttachments() as $attachment) { foreach ($mail->getAttachments() as $attachment) {
$support = 'support'; $support = 'support';
// echo $_SERVER['DOCUMENT_ROOT'];
$dir_img_paths = __DIR__; $dir_img_paths = __DIR__;
$dir_img_path = explode('/code', $dir_img_paths); $dir_img_path = explode('/code', $dir_img_paths);
// dd($attachment->filePath);
$filepath = explode('../../../../../public', $attachment->filePath); $filepath = explode('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public', $attachment->filePath);
// var_dump($attachment->filePath);
// dd($filepath); if ($filepath[1]) {
// $path = $dir_img_path[0]."/code/public/".$filepath[1]; $path = public_path() . $filepath[1];
$path = public_path().$filepath[1];
// dd($path); $filesize = filesize($path);
$filesize = filesize($path); $file_data = file_get_contents($path);
$file_data = file_get_contents($path); $ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION);
$ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION); $imageid = $attachment->id;
$imageid = $attachment->id; $string = str_replace('-', '', $attachment->name);
$string = str_replace('-', '', $attachment->name); $filename = explode('src', $attachment->filePath);
$filename = explode('src', $attachment->filePath); $filename = str_replace('\\', '', $filename);
$filename = str_replace('\\', '', $filename); $body = str_replace('cid:' . $imageid, $filepath[1], $body);
$body = str_replace('cid:'.$imageid, $filepath[1], $body); $pos = strpos($body, $filepath[1]);
$pos = strpos($body, $filepath[1]); if ($pos == false) {
if ($pos == false) { if ($settings_email->first()->attachment == 1) {
if ($settings_email->first()->attachment == 1) { $upload = new Ticket_attachments();
$upload->file = $file_data;
$upload->thread_id = $thread_id;
$upload->name = $filepath[1];
$upload->type = $ext;
$upload->size = $filesize;
$upload->poster = 'ATTACHMENT';
$upload->save();
}
} else {
$upload = new Ticket_attachments(); $upload = new Ticket_attachments();
$upload->file = $file_data; $upload->file = $file_data;
$upload->thread_id = $thread_id; $upload->thread_id = $thread_id;
$upload->name = $filepath[1]; $upload->name = $filepath[1];
$upload->type = $ext; $upload->type = $ext;
$upload->size = $filesize; $upload->size = $filesize;
$upload->poster = 'ATTACHMENT'; $upload->poster = 'INLINE';
$upload->save(); $upload->save();
} }
} else { unlink($path);
$upload = new Ticket_attachments();
$upload->file = $file_data;
$upload->thread_id = $thread_id;
$upload->name = $filepath[1];
$upload->type = $ext;
$upload->size = $filesize;
$upload->poster = 'INLINE';
$upload->save();
} }
unlink($path);
} }
$body = Encoding::fixUTF8($body); $body = $body;
$thread = Ticket_Thread::where('id', '=', $thread_id)->first(); $thread = Ticket_Thread::where('id', '=', $thread_id)->first();
$thread->body = $this->separate_reply($body); $thread->body = $this->separate_reply($body);
$thread->save(); $thread->save();
@@ -226,8 +251,7 @@ class MailController extends Controller
* *
* @return type string * @return type string
*/ */
public function separate_reply($body) public function separate_reply($body) {
{
$body2 = explode('---Reply above this line---', $body); $body2 = explode('---Reply above this line---', $body);
$body3 = $body2[0]; $body3 = $body2[0];
@@ -241,8 +265,7 @@ class MailController extends Controller
* *
* @return type string * @return type string
*/ */
public function decode_imap_text($str) public function decode_imap_text($str) {
{
$result = ''; $result = '';
$decode_header = imap_mime_header_decode($str); $decode_header = imap_mime_header_decode($str);
foreach ($decode_header as $obj) { foreach ($decode_header as $obj) {
@@ -257,8 +280,7 @@ class MailController extends Controller
* *
* @return type * @return type
*/ */
public function fetch_attachments() public function fetch_attachments() {
{
$uploads = Upload::all(); $uploads = Upload::all();
foreach ($uploads as $attachment) { foreach ($uploads as $attachment) {
$image = @imagecreatefromstring($attachment->file); $image = @imagecreatefromstring($attachment->file);
@@ -266,8 +288,8 @@ class MailController extends Controller
imagejpeg($image, null, 80); imagejpeg($image, null, 80);
$data = ob_get_contents(); $data = ob_get_contents();
ob_end_clean(); ob_end_clean();
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,'.base64_encode($data).'"/></a>'; $var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>'; echo '<br/><span class="mailbox-attachment-icon has-img">' . $var . '</span>';
} }
} }
@@ -278,19 +300,17 @@ class MailController extends Controller
* *
* @return type file * @return type file
*/ */
public function get_data($id) public function get_data($id) {
{
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get(); $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
header('Content-type: application/'.$attachment->type.''); header('Content-type: application/' . $attachment->type . '');
header('Content-Disposition: inline; filename='.$attachment->name.''); header('Content-Disposition: inline; filename=' . $attachment->name . '');
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
echo $attachment->file; echo $attachment->file;
} }
} }
public static function trimTableTag($html) public static function trimTableTag($html) {
{
if (strpos('<table>', $html) != false) { if (strpos('<table>', $html) != false) {
$first_pos = strpos($html, '<table'); $first_pos = strpos($html, '<table');
$fist_string = substr_replace($html, '', 0, $first_pos); $fist_string = substr_replace($html, '', 0, $first_pos);
@@ -306,15 +326,13 @@ class MailController extends Controller
return $html; return $html;
} }
public static function trim3D($html) public static function trim3D($html) {
{
$body = str_replace('=3D', '', $html); $body = str_replace('=3D', '', $html);
return $body; return $body;
} }
public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>']) public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>']) {
{
$replace = []; $replace = [];
foreach ($tags as $key => $tag) { foreach ($tags as $key => $tag) {
$replace[$key] = htmlspecialchars($tag); $replace[$key] = htmlspecialchars($tag);
@@ -323,4 +341,5 @@ class MailController extends Controller
return $body; return $body;
} }
} }

View File

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

View File

@@ -28,7 +28,6 @@ class Ticket2Controller extends Controller
*/ */
public function __construct() public function __construct()
{ {
SettingsController::smtp();
$this->middleware('auth'); $this->middleware('auth');
} }
@@ -51,6 +50,11 @@ class Ticket2Controller extends Controller
} }
} }
/**
* this function returns the list of open tickets of a particular department
* @param type $id
* @return type
*/
public function getOpenTickets($id) public function getOpenTickets($id)
{ {
if (Auth::user()->role == 'admin') { if (Auth::user()->role == 'admin') {
@@ -59,7 +63,6 @@ class Ticket2Controller extends Controller
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
} }
return Ttable::getTable($tickets); return Ttable::getTable($tickets);
} }
@@ -81,23 +84,27 @@ class Ticket2Controller extends Controller
return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id')); return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id'));
} }
} }
/**
* this function returns the list of close tickets of a particular department
* @param type $id
* @return type
*/
public function getCloseTickets($id) public function getCloseTickets($id)
{ {
if (Auth::user()->role == 'admin') { if (Auth::user()->role == 'admin') {
$tickets = Tickets::where('status', '=', '2')->where('dept_id', '=', $id)->get(); $tickets = Tickets::where('status', '=', '2')->where('status', '=', '3')->where('dept_id', '=', $id)->get();
} else { } else {
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', '2')->where('dept_id', '=', $dept->id)->get(); $tickets = Tickets::where('status', '=', '2')->where('status', '=', '3')->where('dept_id', '=', $dept->id)->get();
} }
return Ttable::getTable($tickets); return Ttable::getTable($tickets);
} }
/** /**
* Show the Inbox ticket list page. * this function returns the list of close tickets of a particular department
* * @param type $id
* @return type response * @return type
*/ */
public function deptinprogress($id) public function deptinprogress($id)
{ {
@@ -129,4 +136,5 @@ class Ticket2Controller extends Controller
return Ttable::getTable($tickets); return Ttable::getTable($tickets);
} }
}
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\PhpMailController;
// requests // requests
/* Include Sys_user Model */ /* Include Sys_user Model */
use App\Http\Requests\helpdesk\ProfilePassword; use App\Http\Requests\helpdesk\ProfilePassword;
@@ -44,8 +45,9 @@ class UserController extends Controller
* *
* @return void * @return void
*/ */
public function __construct() public function __construct(PhpMailController $PhpMailController)
{ {
$this->PhpMailController = $PhpMailController;
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if role is agent // checking if role is agent
@@ -77,7 +79,7 @@ class UserController extends Controller
public function user_list() public function user_list()
{ {
// displaying list of users with chumper datatables // displaying list of users with chumper datatables
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) return \Datatable::collection(User::where('role',"=","user")->get())
/* searchable column username and email */ /* searchable column username and email */
->searchColumns('user_name', 'email', 'phone') ->searchColumns('user_name', 'email', 'phone')
/* order column username and email */ /* order column username and email */
@@ -179,13 +181,17 @@ class UserController extends Controller
/* insert the input request to sys_user table */ /* insert the input request to sys_user table */
/* Check whether function success or not */ /* Check whether function success or not */
$user->email = $request->input('email'); $user->email = $request->input('email');
$user->user_name = $request->input('full_name'); $user->first_name = $request->input('first_name');
$user->last_name = $request->input('last_name');
$user->user_name = $request->input('user_name');
$user->mobile = $request->input('mobile'); $user->mobile = $request->input('mobile');
$user->ext = $request->input('ext'); $user->ext = $request->input('ext');
$user->phone_number = $request->input('phone_number'); $user->phone_number = $request->input('phone_number');
$user->country_code = $request->input('country_code'); $user->country_code = $request->input('country_code');
$user->active = $request->input('active'); $user->active = $request->input('active');
$user->internal_note = $request->input('internal_note'); $user->internal_note = $request->input('internal_note');
$password = $this->generateRandomString();
$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') != '')) {
@@ -196,7 +202,24 @@ class UserController extends Controller
return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput(); return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput();
} }
} }
$user->save(); // save user credentails
if ($user->save() == true) {
// fetch user credentails to send mail
$name = $user->user_name;
$email = $user->email;
if($request->input('send_email')) {
try {
// send mail on registration
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} catch (Exception $e) {
// returns if try fails
return redirect('user')->with('warning', Lang::get('lang.user_send_mail_error_on_user_creation'));
}
}
// returns for the success case
return redirect('user')->with('success', Lang::get('lang.User-Created-Successfully'));
}
// $user->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('user')->with('success', Lang::get('lang.User-Created-Successfully')); return redirect('user')->with('success', Lang::get('lang.User-Created-Successfully'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -260,6 +283,7 @@ class UserController extends Controller
*/ */
public function update($id, Sys_userUpdate $request) public function update($id, Sys_userUpdate $request)
{ {
// dd($request);
$user = new User(); $user = new User();
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
@@ -336,11 +360,11 @@ class UserController extends Controller
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
if ($request->input('gender') == 1) { if ($request->input('gender') == 1) {
$name = 'avatar5.png'; $name = 'avatar5.png';
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'uploads/profilepic';
$user->profile_pic = $name; $user->profile_pic = $name;
} elseif ($request->input('gender') == 0) { } elseif ($request->input('gender') == 0) {
$name = 'avatar2.png'; $name = 'avatar2.png';
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'uploads/profilepic';
$user->profile_pic = $name; $user->profile_pic = $name;
} }
} }
@@ -349,7 +373,7 @@ class UserController extends Controller
// fetching picture name // fetching picture name
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
// fetching upload destination path // fetching upload destination path
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'uploads/profilepic';
// adding a random value to profile picture filename // adding a random value to profile picture filename
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999).'.'.$name;
// moving the picture to a destination folder // moving the picture to a destination folder
@@ -486,4 +510,29 @@ class UserController extends Controller
return 0; return 0;
} }
} }
/**
* Generate a random string for password.
*
* @param type $length
*
* @return string
*/
public function generateRandomString($length = 10)
{
// list of supported characters
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
// character length checked
$charactersLength = strlen($characters);
// creating an empty variable for random string
$randomString = '';
// fetching random string
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
// return random string
return $randomString;
}
} }

View File

@@ -1,427 +0,0 @@
<?php
namespace App\Http\Controllers\Agent\helpdesk;
// controllers
use App\Http\Controllers\Controller;
// requests
/* Include Sys_user Model */
use App\Http\Requests\helpdesk\ProfilePassword;
/* For validation include Sys_userRequest in create */
use App\Http\Requests\helpdesk\ProfileRequest;
/* For validation include Sys_userUpdate in update */
use App\Http\Requests\helpdesk\Sys_userRequest;
/* include guest_note model */
use App\Http\Requests\helpdesk\Sys_userUpdate;
// models
use App\Model\helpdesk\Agent_panel\Organization;
use App\Model\helpdesk\Agent_panel\User_org;
use App\User;
// classes
use Auth;
use Exception;
use Hash;
use Input;
use Redirect;
/**
* UserController
* This controller is used to CRUD an User details, and proile management of an agent.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class UserController2 extends Controller
{
/**
* Create a new controller instance.
* constructor to check
* 1. authentication
* 2. user roles
* 3. roles must be agent.
*
* @return void
*/
public function __construct()
{
// checking authentication
$this->middleware('auth');
// checking if role is agent
$this->middleware('role.agent');
}
/**
* Display all list of the users.
*
* @param type User $user
*
* @return type view
*/
public function index()
{
try {
/* get all values in Sys_user */
return view('themes.default1.agent.helpdesk.user.index');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* This function is used to display the list of users using chumper datatables.
*
* @return datatable
*/
public function user_list()
{
// displaying list of users with chumper datatables
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
/* searchable column username and email*/
->searchColumns('user_name', 'email', 'phone')
/* order column username and email */
->orderColumns('user_name', 'email')
/* column username */
->addColumn('user_name', function ($model) {
if (strlen($model->user_name) > 20) {
$username = substr($model->user_name, 0, 30);
$username = substr($username, 0, strrpos($username, ' ')).' ...';
} else {
$username = "<a href='".route('user.edit', $model->id)."'>".$model->user_name.'</a>';
}
return $username;
})
/* column email */
->addColumn('email', function ($model) {
$email = "<a href='".route('user.edit', $model->id)."'>".$model->email.'</a>';
return $email;
})
/* column phone */
->addColumn('phone', function ($model) {
$phone = '';
if ($model->phone_number) {
$phone = $model->ext.' '.$model->phone_number;
}
$mobile = '';
if ($model->mobile) {
$mobile = $model->mobile;
}
$phone = $phone.'&nbsp;&nbsp;&nbsp;'.$mobile;
return $phone;
})
/* column account status */
->addColumn('status', function ($model) {
$status = $model->active;
if ($status == 1) {
$stat = '<button class="btn btn-success btn-xs">Active</button>';
} else {
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
}
return $stat;
})
/* column ban status */
->addColumn('ban', function ($model) {
$status = $model->ban;
if ($status == 1) {
$stat = '<button class="btn btn-danger btn-xs">Banned</button>';
} else {
$stat = '<button class="btn btn-success btn-xs">Active</button>';
}
return $stat;
})
/* column last login date */
->addColumn('lastlogin', function ($model) {
$t = $model->updated_at;
return TicketController::usertimezone($t);
})
/* column actions */
->addColumn('Actions', function ($model) {
return '<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp; <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
})
->make();
}
/**
* Show the form for creating a new users.
*
* @return type view
*/
public function create()
{
try {
return view('themes.default1.agent.helpdesk.user.create');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* Store a newly created users in storage.
*
* @param type User $user
* @param type Sys_userRequest $request
*
* @return type redirect
*/
public function store(User $user, Sys_userRequest $request)
{
/* insert the input request to sys_user table */
/* Check whether function success or not */
$user->email = $request->input('email');
$user->user_name = $request->input('full_name');
$user->mobile = $request->input('mobile');
$user->ext = $request->input('ext');
$user->phone_number = $request->input('phone_number');
$user->active = $request->input('active');
$user->internal_note = $request->input('internal_note');
$user->role = 'user';
try {
$user->save();
/* redirect to Index page with Success Message */
return redirect('user')->with('success', 'User Created Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('user')->with('fails', $e->errorInfo[2]);
}
}
/**
* Display the specified users.
*
* @param type int $id
* @param type User $user
*
* @return type view
*/
public function show($id, User $user)
{
try {
/* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.show', compact('users'));
} catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for editing the specified resource.
*
* @param type int $id
* @param type User $user
*
* @return type Response
*/
public function edit($id, User $user)
{
try {
/* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* Update the specified user in storage.
*
* @param type int $id
* @param type User $user
* @param type Sys_userUpdate $request
*
* @return type Response
*/
public function update($id, User $user, Sys_userUpdate $request)
{
/* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first();
/* Update the value by selected field */
/* Check whether function success or not */
try {
$users->fill($request->input())->save();
/* redirect to Index page with Success Message */
return redirect('user')->with('success', 'User Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* get agent profile page.
*
* @return type view
*/
public function getProfile()
{
$user = Auth::user();
try {
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* get profile edit page.
*
* @return type view
*/
public function getProfileedit()
{
$user = Auth::user();
try {
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* post profile edit.
*
* @param type int $id
* @param type ProfileRequest $request
*
* @return type Redirect
*/
public function postProfileedit(ProfileRequest $request)
{
// geet authenticated user details
$user = Auth::user();
$user->gender = $request->input('gender');
$user->save();
// checking availability of agent profile ppicture
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
if ($request->input('gender') == 1) {
$name = 'avatar5.png';
$destinationPath = 'lb-faveo/media/profilepic';
$user->profile_pic = $name;
} elseif ($request->input('gender') == 0) {
$name = 'avatar2.png';
$destinationPath = 'lb-faveo/media/profilepic';
$user->profile_pic = $name;
}
}
// checking if the post system includes agent profile picture upload
if (Input::file('profile_pic')) {
// fetching picture name
$name = Input::file('profile_pic')->getClientOriginalName();
// fetching upload destination path
$destinationPath = 'lb-faveo/media/profilepic';
// adding a random value to profile picture filename
$fileName = rand(0000, 9999).'.'.$name;
// moving the picture to a destination folder
Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database
$user->profile_pic = $fileName;
} else {
try {
$user->fill($request->except('profile_pic', 'gender'))->save();
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
} catch (Exception $e) {
return Redirect::route('profile')->with('success', $e->errorInfo[2]);
}
}
if ($user->fill($request->except('profile_pic'))->save()) {
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
}
}
/**
* Post profile password.
*
* @param type int $id
* @param type ProfilePassword $request
*
* @return type Redirect
*/
public function postProfilePassword($id, ProfilePassword $request)
{
// get authenticated user
$user = Auth::user();
// 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();
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
} catch (Exception $e) {
return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
}
} else {
return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
}
}
/**
* Assigning an user to an organization.
*
* @param type $id
*
* @return type boolean
*/
public function UserAssignOrg($id)
{
$org = Input::get('org');
$user_org = new User_org();
$user_org->org_id = $org;
$user_org->user_id = $id;
$user_org->save();
return 1;
}
/**
* creating an organization in user profile page via modal popup.
*
* @param type $id
*
* @return type
*/
public function User_Create_Org($id)
{
// checking if the entered value for website is available in database
if (Input::get('website') != null) {
// checking website
$check = Organization::where('website', '=', Input::get('website'))->first();
} else {
$check = null;
}
// checking if the name is unique
$check2 = Organization::where('name', '=', Input::get('name'))->first();
// if any of the fields is not available then return false
if (\Input::get('name') == null) {
return 'Name is required';
} elseif ($check2 != null) {
return 'Name should be Unique';
} elseif ($check != null) {
return 'Website should be Unique';
} else {
// storing organization details and assigning the current user to that organization
$org = new Organization();
$org->name = Input::get('name');
$org->phone = Input::get('phone');
$org->website = Input::get('website');
$org->address = Input::get('address');
$org->internal_notes = Input::get('internal');
$org->save();
$user_org = new User_org();
$user_org->org_id = $org->id;
$user_org->user_id = $id;
$user_org->save();
// for success return 0
return 0;
}
}
}

View File

@@ -63,23 +63,18 @@ class ArticleController extends Controller
public function getData() public function getData()
{ {
$article = new Article(); $article = new Article();
$articles = $article
->select('id', 'name', 'description', 'publish_time', 'slug')
->orderBy('publish_time','desc')
->get();
// returns chumper datatable // returns chumper datatable
return Datatable::query($article) return Datatable::Collection($articles)
/* searcable column name */
->searchColumns('name')
/* order column name and description */
->orderColumns('name', 'description')
/* add column name */ /* add column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
$string = strip_tags($model->name); $name = str_limit($model->name, 20, '...');
if (strlen($string) > 40) {
// truncate string
$stringCut = substr($string, 0, 40);
} else {
$stringCut = $model->name;
}
return $stringCut.'...'; return "<p title=$model->name>$name</p>";
}) })
/* add column Created */ /* add column Created */
->addColumn('publish_time', function ($model) { ->addColumn('publish_time', function ($model) {
@@ -90,7 +85,7 @@ class ArticleController extends Controller
/* add column action */ /* add column action */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
/* here are all the action buttons and modal popup to delete articles with confirmations */ /* here are all the action buttons and modal popup to delete articles with confirmations */
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span>&nbsp;<a href=article/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href=show/'.$model->slug.' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a> return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span>&nbsp;<a href='.url("article/$model->id/edit").' class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href='.url("show/$model->slug").' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
<div class="modal fade" id="deletearticle'.$model->id.'"> <div class="modal fade" id="deletearticle'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
@@ -103,12 +98,14 @@ class ArticleController extends Controller
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="article/delete/'.$model->slug.'"><button class="btn btn-danger">delete</button></a> <a href='.url("article/delete/$model->slug").'><button class="btn btn-danger">delete</button></a>
</div> </div>
</div><!-- /.modal-content --> </div>
</div><!-- /.modal-dialog --> </div>
</div>'; </div>';
}) })
->searchColumns('name', 'description', 'publish_time')
->orderColumns('name', 'description', 'publish_time')
->make(); ->make();
} }
@@ -253,9 +250,9 @@ class ArticleController extends Controller
$article->publish_time = $publishTime; $article->publish_time = $publishTime;
$article->save(); $article->save();
return redirect('article')->with('success', Lang::get('lang.article_updated_successfully')); return redirect()->back()->with('success', Lang::get('lang.article_updated_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect('article')->with('fails', Lang::get('lang.article_not_updated').'<li>'.$e->getMessage().'</li>'); return redirect()->back()->with('fails', Lang::get('lang.article_not_updated').'<li>'.$e->getMessage().'</li>');
} }
} }
@@ -285,12 +282,12 @@ class ArticleController extends Controller
} }
if ($article) { if ($article) {
if ($article->delete()) {//true:redirect to index page with success message if ($article->delete()) {//true:redirect to index page with success message
return Redirect::back()->with('success', Lang::get('lang.article_deleted_successfully')); return redirect('article')->with('success', Lang::get('lang.article_deleted_successfully'));
} else { //redirect to index page with fails message } else { //redirect to index page with fails message
return Redirect::back()->with('fails', Lang::get('lang.article_not_deleted')); return redirect('article')->with('fails', Lang::get('lang.article_not_deleted'));
} }
} else { } else {
return Redirect::back()->with('fails', Lang::get('lang.article_can_not_deleted')); return redirect('article')->with('fails', Lang::get('lang.article_can_not_deleted'));
} }
} }

View File

@@ -77,14 +77,7 @@ class CategoryController extends Controller
/* add column name */ /* add column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
$string = strip_tags($model->name); $string = strip_tags($model->name);
if (strlen($string) > 40) { return str_limit($string, 20);
// truncate string
$stringCut = substr($string, 0, 40);
} else {
$stringCut = $model->name;
}
return $stringCut.'...';
}) })
/* add column Created */ /* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
@@ -127,7 +120,7 @@ class CategoryController extends Controller
public function create(Category $category) public function create(Category $category)
{ {
/* Get the all attributes in the category model */ /* Get the all attributes in the category model */
$category = $category->get(); $category = $category->lists('name','id')->toArray();
/* get the view page to create new category with all attributes /* get the view page to create new category with all attributes
of category model */ of category model */
try { try {
@@ -148,13 +141,12 @@ class CategoryController extends Controller
public function store(Category $category, CategoryRequest $request) public function store(Category $category, CategoryRequest $request)
{ {
/* Get the whole request from the form and insert into table via model */ /* Get the whole request from the form and insert into table via model */
$sl = $request->input('slug'); $sl = $request->input('name');
$slug = str_slug($sl, '-'); $slug = str_slug($sl, '-');
$category->slug = $slug; $category->slug = $slug;
// send success message to index page // send success message to index page
try { try {
$category->fill($request->except('slug'))->save(); $category->fill($request->input())->save();
return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully')); return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>'); return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>');
@@ -169,15 +161,13 @@ class CategoryController extends Controller
* *
* @return type view * @return type view
*/ */
public function edit($slug) public function edit($id)
{ {
// fetch the category
$cid = Category::where('id', $slug)->first();
$id = $cid->id;
/* get the atributes of the category model whose id == $id */ /* get the atributes of the category model whose id == $id */
$category = Category::whereId($id)->first(); $category = Category::whereId($id)->first();
$categories = Category::lists('name','id')->toArray();
/* get the Edit page the selected category via id */ /* get the Edit page the selected category via id */
return view('themes.default1.agent.kb.category.edit', compact('category')); return view('themes.default1.agent.kb.category.edit', compact('category','categories'));
} }
/** /**
@@ -189,22 +179,18 @@ class CategoryController extends Controller
* *
* @return type redirect * @return type redirect
*/ */
public function update($slug, CategoryUpdate $request) public function update($id, CategoryRequest $request)
{ {
/* Edit the selected category via id */ /* Edit the selected category via id */
$category = Category::where('id', $slug)->first(); $category = Category::where('id', $id)->first();
$sl = $request->input('slug'); $sl = $request->input('name');
$slug = str_slug($sl, '-'); $slug = str_slug($sl, '-');
// dd($slug);
$category->slug = $slug;
/* update the values at the table via model according with the request */ /* update the values at the table via model according with the request */
//redirct to index page with success message //redirct to index page with success message
try { try {
$category->fill($request->all())->save();
$category->slug = $slug; $category->slug = $slug;
$category->save(); $category->fill($request->input())->save();
return redirect('category')->with('success', Lang::get('lang.category_updated_successfully')); return redirect('category')->with('success', Lang::get('lang.category_updated_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
//redirect to index with fails message //redirect to index with fails message

View File

@@ -125,11 +125,11 @@ class PageController extends Controller
*/ */
public function store(PageRequest $request) public function store(PageRequest $request)
{ {
$sl = $request->input('slug'); $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->except('slug'))->save(); $this->page->fill($request->input())->save();
return redirect('page')->with('success', Lang::get('lang.page_created_successfully')); return redirect('page')->with('success', Lang::get('lang.page_created_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -163,13 +163,12 @@ class PageController extends Controller
* *
* @return type redirect * @return type redirect
*/ */
public function update($slug, PageUpdate $request) public function update($slug, PageRequest $request)
{ {
// get pages with respect to slug // get pages with respect to slug
$pages = $this->page->where('slug', $slug)->first(); $pages = $this->page->where('slug', $slug)->first();
$sl = $request->input('slug'); $sl = $request->input('name');
$slug = str_slug($sl, '-'); $slug = str_slug($sl, '-');
$this->page->slug = $slug;
try { try {
$pages->fill($request->all())->save(); $pages->fill($request->all())->save();
$pages->slug = $slug; $pages->slug = $slug;

Binary file not shown.

View File

@@ -33,8 +33,8 @@ use Illuminate\Support\Collection;
* *
* @version v1 * @version v1
*/ */
class ApiController extends Controller class ApiController extends Controller {
{
public $user; public $user;
public $request; public $request;
public $ticket; public $ticket;
@@ -54,8 +54,7 @@ class ApiController extends Controller
/** /**
* @param Request $request * @param Request $request
*/ */
public function __construct(Request $request) public function __construct(Request $request) {
{
$this->request = $request; $this->request = $request;
$this->middleware('jwt.auth'); $this->middleware('jwt.auth');
@@ -64,7 +63,9 @@ class ApiController extends Controller
$user = \JWTAuth::parseToken()->authenticate(); $user = \JWTAuth::parseToken()->authenticate();
$this->user = $user; $this->user = $user;
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) { } catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) { } catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
} }
$ticket = new TicketController(); $ticket = new TicketController();
@@ -119,17 +120,16 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function createTicket() public function createTicket() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id', 'user_id' => 'required|exists:users,id',
'subject' => 'required', 'subject' => 'required',
'body' => 'required', 'body' => 'required',
'helptopic' => 'required|exists:help_topic,id', 'helptopic' => 'required|exists:help_topic,id',
'sla' => 'required|exists:sla_plan,id', 'sla' => 'required|exists:sla_plan,id',
'priority' => 'required|exists:ticket_priority,priority_id', 'priority' => 'required|exists:ticket_priority,priority_id',
'dept' => 'required|exists:department,id', 'dept' => 'required|exists:department,id',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
@@ -178,7 +178,7 @@ class ApiController extends Controller
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')) return response()->json(compact('error'))
->header('Authenticate: xBasic realm', 'fake'); ->header('Authenticate: xBasic realm', 'fake');
} }
} }
@@ -189,12 +189,11 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function ticketReply() public function ticketReply() {
{
//dd($this->request->all()); //dd($this->request->all());
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_ID' => 'required|exists:tickets,id', 'ticket_ID' => 'required|exists:tickets,id',
'reply_content' => 'required', 'reply_content' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
@@ -224,15 +223,14 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function editTicket() public function editTicket() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_id' => 'required|exists:tickets,id', 'ticket_id' => 'required|exists:tickets,id',
'subject' => 'required', 'subject' => 'required',
'sla_plan' => 'required|exists:sla_plan,id', 'sla_plan' => 'required|exists:sla_plan,id',
'help_topic' => 'required|exists:help_topic,id', 'help_topic' => 'required|exists:help_topic,id',
'ticket_source' => 'required|exists:ticket_source,id', 'ticket_source' => 'required|exists:ticket_source,id',
'ticket_priority' => 'required|exists:ticket_priority,priority_id', 'ticket_priority' => 'required|exists:ticket_priority,priority_id',
]); ]);
if ($v->fails()) { if ($v->fails()) {
@@ -262,8 +260,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function deleteTicket() public function deleteTicket() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_id' => 'required|exists:tickets,id', 'ticket_id' => 'required|exists:tickets,id',
@@ -296,16 +293,15 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function openedTickets() public function openedTickets() {
{
try { try {
// $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get(); // $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
// return response()->json(compact('result')); // return response()->json(compact('result'));
$result = $this->user->join('tickets', function ($join) { $result = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('isanswered', '=', 0)->where('status', '=', 1)->whereNull('assigned_to'); ->where('isanswered', '=', 0)->where('status', '=', 1)->whereNull('assigned_to');
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -341,16 +337,15 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function unassignedTickets() public function unassignedTickets() {
{
try { try {
//dd('sdhjbc'); //dd('sdhjbc');
// $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get(); // $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
// return response()->json(compact('result')); // return response()->json(compact('result'));
$unassigned = $this->user->join('tickets', function ($join) { $unassigned = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->whereNull('assigned_to')->where('status', '=', 1); ->whereNull('assigned_to')->where('status', '=', 1);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -360,8 +355,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
@@ -386,16 +381,15 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function closeTickets() public function closeTickets() {
{
try { try {
// $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get(); // $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
// return response()->json(compact('result')); // return response()->json(compact('result'));
$result = $this->user->join('tickets', function ($join) { $result = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('isanswered', '=', 0)->where('status', '>', 1)->where('status', '<', 4); ->where('status','=',3)->orWhere('status','=',2);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -405,8 +399,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
@@ -431,8 +425,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getAgents() public function getAgents() {
{
try { try {
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get(); $result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
@@ -455,8 +448,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getTeams() public function getTeams() {
{
try { try {
$result = $this->team->get(); $result = $this->team->get();
@@ -479,12 +471,11 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function assignTicket() public function assignTicket() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'ticket_id' => 'required', 'ticket_id' => 'required',
'user' => 'required', 'user' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
@@ -518,8 +509,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getCustomers() public function getCustomers() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'search' => 'required', 'search' => 'required',
@@ -530,10 +520,10 @@ class ApiController extends Controller
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$search = $this->request->input('search'); $search = $this->request->input('search');
$result = $this->faveoUser->where('first_name', 'like', '%'.$search.'%')->orWhere('last_name', 'like', '%'.$search.'%')->orWhere('user_name', 'like', '%'.$search.'%')->orWhere('email', 'like', '%'.$search.'%')->get(); $result = $this->faveoUser->where('first_name', 'like', '%' . $search . '%')->orWhere('last_name', 'like', '%' . $search . '%')->orWhere('user_name', 'like', '%' . $search . '%')->orWhere('email', 'like', '%' . $search . '%')->get();
return response()->json(compact('result')) return response()->json(compact('result'))
->header('X-Header-One', 'Header Value'); ->header('X-Header-One', 'Header Value');
} catch (Exception $e) { } catch (Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
@@ -544,8 +534,7 @@ class ApiController extends Controller
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')) return response()->json(compact('error'))
->header('X-Header-One', 'Header Value');
->header('X-Header-One', 'Header Value');
} }
} }
@@ -554,8 +543,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getCustomersWith() public function getCustomersWith() {
{
try { try {
$users = $this->user $users = $this->user
->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id') ->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id')
@@ -577,7 +565,7 @@ class ApiController extends Controller
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')) return response()->json(compact('error'))
->header('Authenticate: xBasic realm', 'fake'); ->header('Authenticate: xBasic realm', 'fake');
} }
} }
@@ -586,8 +574,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getCustomer() public function getCustomer() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required', 'user_id' => 'required',
@@ -619,8 +606,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function searchTicket() public function searchTicket() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'search' => 'required', 'search' => 'required',
@@ -631,7 +617,7 @@ class ApiController extends Controller
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$search = $this->request->input('search'); $search = $this->request->input('search');
$result = $this->thread->select('ticket_id')->where('title', 'like', '%'.$search.'%')->orWhere('body', 'like', '%'.$search.'%')->get(); $result = $this->thread->select('ticket_id')->where('title', 'like', '%' . $search . '%')->orWhere('body', 'like', '%' . $search . '%')->get();
return response()->json(compact('result')); return response()->json(compact('result'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -652,8 +638,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function ticketThreads() public function ticketThreads() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'id' => 'required', 'id' => 'required',
@@ -690,8 +675,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function checkUrl() public function checkUrl() {
{
//dd($this->request); //dd($this->request);
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
@@ -708,7 +692,7 @@ class ApiController extends Controller
$url = str_finish($url, '/'); $url = str_finish($url, '/');
} }
$url = $url.'/api/v1/helpdesk/check-url?api_key='.$this->request->input('api_key').'&token='.\Config::get('app.token'); $url = $url . '/api/v1/helpdesk/check-url?api_key=' . $this->request->input('api_key') . '&token=' . \Config::get('app.token');
$result = $this->CallGetApi($url); $result = $this->CallGetApi($url);
//dd($result); //dd($result);
return response()->json(compact('result')); return response()->json(compact('result'));
@@ -728,8 +712,7 @@ class ApiController extends Controller
* *
* @return string * @return string
*/ */
public function urlResult() public function urlResult() {
{
return 'success'; return 'success';
} }
@@ -740,8 +723,7 @@ class ApiController extends Controller
* *
* @return type int|string|json * @return type int|string|json
*/ */
public function callGetApi($url) public function callGetApi($url) {
{
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
@@ -750,7 +732,7 @@ class ApiController extends Controller
$response = curl_exec($curl); $response = curl_exec($curl);
if (curl_errno($curl)) { if (curl_errno($curl)) {
echo 'error:'.curl_error($curl); echo 'error:' . curl_error($curl);
} }
return $response; return $response;
@@ -765,8 +747,7 @@ class ApiController extends Controller
* *
* @return type int|string|json * @return type int|string|json
*/ */
public function callPostApi($url, $data) public function callPostApi($url, $data) {
{
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
@@ -776,7 +757,7 @@ class ApiController extends Controller
$response = curl_exec($curl); $response = curl_exec($curl);
if (curl_errno($curl)) { if (curl_errno($curl)) {
echo 'error:'.curl_error($curl); echo 'error:' . curl_error($curl);
} }
return $response; return $response;
@@ -788,8 +769,7 @@ class ApiController extends Controller
* *
* @return type | json * @return type | json
*/ */
public function generateApiKey() public function generateApiKey() {
{
try { try {
$set = $this->setting->where('id', '1')->first(); $set = $this->setting->where('id', '1')->first();
//dd($set); //dd($set);
@@ -823,8 +803,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getHelpTopic() public function getHelpTopic() {
{
try { try {
$result = $this->helptopic->get(); $result = $this->helptopic->get();
@@ -847,8 +826,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getSlaPlan() public function getSlaPlan() {
{
try { try {
$result = $this->slaPlan->get(); $result = $this->slaPlan->get();
@@ -871,8 +849,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getPriority() public function getPriority() {
{
try { try {
$result = $this->priority->get(); $result = $this->priority->get();
@@ -895,8 +872,7 @@ class ApiController extends Controller
* *
* @return json * @return json
*/ */
public function getDepartment() public function getDepartment() {
{
try { try {
$result = $this->department->get(); $result = $this->department->get();
@@ -919,8 +895,7 @@ class ApiController extends Controller
* *
* @return type json * @return type json
*/ */
public function getTickets() public function getTickets() {
{
try { try {
$tickets = $this->model->orderBy('created_at', 'desc')->paginate(10); $tickets = $this->model->orderBy('created_at', 'desc')->paginate(10);
$tickets->toJson(); $tickets->toJson();
@@ -944,10 +919,13 @@ class ApiController extends Controller
* *
* @return type json * @return type json
*/ */
public function inbox() public function inbox() {
{
try { try {
$inbox = $this->user->join('tickets', 'users.id', '=', 'tickets.user_id')
$inbox = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id')
->where('status', '=', 1);
})
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -955,10 +933,10 @@ class ApiController extends Controller
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status') ->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
->join('ticket_thread', function ($join) { ->join('ticket_thread', function ($join) {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('ticket_thread.title');
}) })
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'ticket_thread.title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
@@ -983,13 +961,12 @@ class ApiController extends Controller
* *
* @return type json * @return type json
*/ */
public function internalNote() public function internalNote() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'userid' => 'required|exists:users,id', 'userid' => 'required|exists:users,id',
'ticketid' => 'required|exists:tickets,id', 'ticketid' => 'required|exists:tickets,id',
'body' => 'required', 'body' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
@@ -1016,13 +993,12 @@ class ApiController extends Controller
} }
} }
public function getTrash() public function getTrash() {
{
try { try {
$trash = $this->user->join('tickets', function ($join) { $trash = $this->user->join('tickets', function ($join) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('status', '=', 5); ->where('status', '=', 5);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -1032,8 +1008,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc') ->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
@@ -1053,8 +1029,7 @@ class ApiController extends Controller
} }
} }
public function getMyTicketsAgent() public function getMyTicketsAgent() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id', 'user_id' => 'required|exists:users,id',
@@ -1071,9 +1046,10 @@ class ApiController extends Controller
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$result = $this->user->join('tickets', function ($join) use ($id) { $result = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.assigned_to') $join->on('users.id', '=', 'tickets.assigned_to')
->where('user_id', '=', $id); ->where('status', '=', 1);
}) //->where('user_id', '=', $id);
})
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -1083,8 +1059,9 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id') $join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title'); ->whereNotNull('title');
}) })
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name') ->where('users.id',$id)
->orderBy('ticket_thread.updated_at', 'desc') ->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('updated_at', 'desc')
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
@@ -1104,8 +1081,7 @@ class ApiController extends Controller
} }
} }
public function getMyTicketsUser() public function getMyTicketsUser() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id', 'user_id' => 'required|exists:users,id',
@@ -1122,9 +1098,9 @@ class ApiController extends Controller
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$result = $this->user->join('tickets', function ($join) use ($id) { $result = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.user_id') $join->on('users.id', '=', 'tickets.user_id')
->where('user_id', '=', $id); ->where('user_id', '=', $id);
}) })
->join('department', 'department.id', '=', 'tickets.dept_id') ->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id') ->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla') ->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
@@ -1139,7 +1115,7 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->get() ->get()
// ->paginate(10) // ->paginate(10)
->toJson(); ->toJson();
return $result; return $result;
@@ -1156,8 +1132,7 @@ class ApiController extends Controller
} }
} }
public function getTicketById() public function getTicketById() {
{
try { try {
$v = \Validator::make($this->request->all(), [ $v = \Validator::make($this->request->all(), [
'id' => 'required|exists:tickets,id', 'id' => 'required|exists:tickets,id',
@@ -1169,11 +1144,18 @@ class ApiController extends Controller
} }
$id = $this->request->input('id'); $id = $this->request->input('id');
if (!$this->model->where('id', $id)->first()) { if (!$this->model->where('id', $id)->first()) {
$error = 'There is no Ticket as ticket id: '.$id; $error = 'There is no Ticket as ticket id: ' . $id;
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$result = $this->model->where('id', $id)->first(); $query = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.user_id')
->where('tickets.id', '=', $id);
});
$response = $this->differenciateHelpTopic($query);
//$select = 'users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','num_sequence','user_id','priority_id','sla','max_open_ticket','captcha','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','is_transfer','transfer_at','reopened_at','duedate','closed_at','last_message_at','last_response_at';
$result = $response->addSelect('users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','user_id','priority_id','sla','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','reopened_at','duedate','closed_at','last_message_at','last_response_at','tickets.created_at','tickets.updated_at')->first();
return response()->json(compact('result')); return response()->json(compact('result'));
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -1189,8 +1171,7 @@ class ApiController extends Controller
} }
} }
public function createPagination($array, $perPage) public function createPagination($array, $perPage) {
{
try { try {
//Get current page form url e.g. &page=6 //Get current page form url e.g. &page=6
$currentPage = LengthAwarePaginator::resolveCurrentPage(); $currentPage = LengthAwarePaginator::resolveCurrentPage();
@@ -1218,8 +1199,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();
@@ -1229,7 +1209,7 @@ class ApiController extends Controller
foreach ($emails as $key => $email) { foreach ($emails as $key => $email) {
$user_model = $user->where('email', $email)->first(); $user_model = $user->where('email', $email)->first();
//return $user_model; //return $user_model;
$users[$key]['name'] = $user_model->first_name.' '.$user_model->last_name; $users[$key]['name'] = $user_model->first_name . ' ' . $user_model->last_name;
$users[$key]['email'] = $email; $users[$key]['email'] = $email;
$users[$key]['avatar'] = $this->avatarUrl($email); $users[$key]['avatar'] = $this->avatarUrl($email);
} }
@@ -1246,13 +1226,12 @@ class ApiController extends Controller
} }
} }
public function avatarUrl($email) public function avatarUrl($email) {
{
try { try {
$user = new User(); $user = new User();
$user = $user->where('email', $email)->first(); $user = $user->where('email', $email)->first();
if ($user->profile_pic) { if ($user->profile_pic) {
$url = url('lb-faveo/media/profilepic/'.$user->profile_pic); $url = url('uploads/profilepic/' . $user->profile_pic);
} else { } else {
$url = \Gravatar::src($email); $url = \Gravatar::src($email);
} }
@@ -1264,11 +1243,10 @@ class ApiController extends Controller
} }
} }
public function addCollaboratorForTicket() public function addCollaboratorForTicket() {
{
try { try {
$v = \Validator::make(\Input::get(), [ $v = \Validator::make(\Input::get(), [
'email' => 'required|email|unique:users', 'email' => 'required|email|unique:users',
'ticket_id' => 'required', 'ticket_id' => 'required',
] ]
); );
@@ -1295,8 +1273,7 @@ class ApiController extends Controller
} }
} }
public function getCollaboratorForTicket() public function getCollaboratorForTicket() {
{
try { try {
$v = \Validator::make(\Input::get(), [ $v = \Validator::make(\Input::get(), [
'ticket_id' => 'required', 'ticket_id' => 'required',
@@ -1325,12 +1302,11 @@ class ApiController extends Controller
} }
} }
public function deleteCollaborator() public function deleteCollaborator() {
{
try { try {
$v = \Validator::make(\Input::get(), [ $v = \Validator::make(\Input::get(), [
'ticketid' => 'required', 'ticketid' => 'required',
'email' => 'required', 'email' => 'required',
] ]
); );
if ($v->fails()) { if ($v->fails()) {
@@ -1350,8 +1326,7 @@ class ApiController extends Controller
} }
} }
public function dependency() public function dependency() {
{
try { try {
$department = $this->department->select('name', 'id')->get()->toArray(); $department = $this->department->select('name', 'id')->get()->toArray();
$sla = $this->slaPlan->select('name', 'id')->get()->toArray(); $sla = $this->slaPlan->select('name', 'id')->get()->toArray();
@@ -1362,7 +1337,7 @@ class ApiController extends Controller
$status = \DB::table('ticket_status')->select('name', 'id')->get(); $status = \DB::table('ticket_status')->select('name', 'id')->get();
$source = \DB::table('ticket_source')->select('name', 'id')->get(); $source = \DB::table('ticket_source')->select('name', 'id')->get();
$result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team, $result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source, ]; 'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source,];
return response()->json(compact('result')); return response()->json(compact('result'));
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -1373,4 +1348,73 @@ class ApiController extends Controller
return response()->json(compact('error', 'file', 'line')); return response()->json(compact('error', 'file', 'line'));
} }
} }
public function differenciateHelpTopic($query){
$ticket = $query->first();
$check = 'department';
if($ticket){
if($ticket->dept_id && $ticket->help_topic_id){
return $this->getSystem($check, $query);
}
if(!$ticket->dept_id && $ticket->help_topic_id){
return $query->select('tickets.help_topic_id');
}
if($ticket->dept_id && !$ticket->help_topic_id){
return $query->select('tickets.dept_id');
}
}
}
public function getSystem($check,$query){
switch ($check){
case 'department':
return $query->select('tickets.dept_id');
case 'helpTopic':
return $query->select('tickets.help_topic_id');
default :
return $query->select('tickets.dept_id');
}
}
/**
* Register a user with username and password.
*
* @param Request $request
*
* @return type json
*/
public function register(Request $request)
{
try {
$v = \Validator::make($request->all(), [
'email' => 'required|email|unique:users',
'password' => 'required|min:6',
]);
if ($v->fails()) {
$error = $v->errors();
return response()->json(compact('error'));
}
$auth = $this->user;
$email = $request->input('email');
$username = $request->input('email');
$password = \Hash::make($request->input('password'));
$role = $request->input('role');
if($auth->role=='agent'){
$role = "user";
}
$user = new User();
$user->password = $password;
$user->user_name = $username;
$user->email = $email;
$user->role = $role;
$user->save();
return response()->json(compact('user'));
} catch (\Exception $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
}
}
} }

View File

@@ -0,0 +1,105 @@
<?php
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;
// classes
use LaravelFCM\Message\PayloadNotificationBuilder;
use LaravelFCM\Message\Topics;
use LaravelFCM\Message\OptionsBuilder;
use LaravelFCM\Message\PayloadDataBuilder;
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
*
* @author Ladybird <info@ladybirdweb.com>
*/
class PushNotificationController extends Controller {
public function Response($token, $body, $ticket_id = null) {
$optionBuiler = new OptionsBuilder();
$optionBuiler->setTimeToLive(60 * 60);
$notificationBuilder = new PayloadNotificationBuilder();
$notificationBuilder->setBody($body)
->setSound('default')
->setIcon('ic_stat_f1')
->setClickAction('OPEN_ACTIVITY_1');
if($ticket_id != null) {
$ticket_data = Tickets::where('id', '=', $ticket_id )->first();
$thread_data = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
$dataBuilder = new PayloadDataBuilder();
$dataBuilder->addData(['ticket_id' => $ticket_id]);
$dataBuilder->addData(['ticket_number' => $ticket_data->ticket_number]);
$dataBuilder->addData(['ticket_opened_by' => $ticket_data->user_id]);
$dataBuilder->addData(['ticket_subject' => $thread_data->title]);
}
$option = $optionBuiler->build();
$notification = $notificationBuilder->build();
$data = $dataBuilder->build();
$tokens = $token;
$downstreamResponse = FCM::sendTo($tokens, $option, $notification, $data);
// $downstreamResponse = new DownstreamResponse($response, $tokens);
// dd($downstreamResponse);
$downstreamResponse->numberSuccess();
$downstreamResponse->numberFailure();
$downstreamResponse->numberModification();
// return Array - you must remove all this tokens in your database
$downstreamResponse->tokensToDelete();
// return Array (key : oldToken, value : new token - you must change the token in your database )
$downstreamResponse->tokensToModify();
// return Array - you should try to resend the message to the tokens in the array
$downstreamResponse->tokensToRetry();
// return Array (key:token, value:errror) - in production you should remove from your database the tokens
}
/**
* function to get the fcm token from the api under a user.
* @param \Illuminate\Http\Request $request
* @return type
*/
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 != "") {
// search the user_id in database
$user = $user->where('id', '=', $user_id)->first();
if($user != null) {
$user->fcm_token = $fcm_token;
$user->save();
// success response for success case
return ['response' => 'success'];
} else {
// failure respunse for invalid user_id in the system
return ['response' => 'fail', 'reason' => 'Invalid user_id'];
}
} else {
// failure respunse for invalid input credentials
return ['response' => 'fail', 'reason' => 'Invalid Credentials'];
}
}
}

View File

@@ -422,6 +422,7 @@ class TicketController extends Controller
$ticket->help_topic_id = Input::get('help_topic'); $ticket->help_topic_id = Input::get('help_topic');
$ticket->source = Input::get('ticket_source'); $ticket->source = Input::get('ticket_source');
$ticket->priority_id = Input::get('ticket_priority'); $ticket->priority_id = Input::get('ticket_priority');
$ticket->status = Input::get('status');
$ticket->save(); $ticket->save();
$threads = $thread->where('ticket_id', '=', $ticket_id)->first(); $threads = $thread->where('ticket_id', '=', $ticket_id)->first();
@@ -724,7 +725,7 @@ class TicketController extends Controller
$user = new User(); $user = new User();
$user = $user->where('email', $email)->first(); $user = $user->where('email', $email)->first();
if ($user->profile_pic) { if ($user->profile_pic) {
$url = url('lb-faveo/media/profilepic/'.$user->profile_pic); $url = url('uploads/profilepic/'.$user->profile_pic);
} else { } else {
$url = \Gravatar::src($email); $url = \Gravatar::src($email);
} }

View File

@@ -50,7 +50,7 @@ class TokenAuthController extends Controller
//$credentials = $request->only('email', 'password'); //$credentials = $request->only('email', 'password');
try { try {
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password])) { if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password,'active'=>1])) {
return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]); return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]);
} }
} catch (JWTException $e) { } catch (JWTException $e) {
@@ -100,30 +100,30 @@ class TokenAuthController extends Controller
* *
* @return type json * @return type json
*/ */
public function register(Request $request) // public function register(Request $request)
{ // {
try { // try {
$v = \Validator::make($request->all(), [ // $v = \Validator::make($request->all(), [
'email' => 'required|email|unique:users', // 'email' => 'required|email|unique:users',
'password' => 'required', // 'password' => 'required',
]); // ]);
if ($v->fails()) { // if ($v->fails()) {
$error = $v->errors(); // $error = $v->errors();
//
return response()->json(compact('error')); // return response()->json(compact('error'));
} // }
$newuser = $request->all(); // $newuser = $request->all();
$password = Hash::make($request->input('password')); // $password = Hash::make($request->input('password'));
//
$newuser['password'] = $password; // $newuser['password'] = $password;
//
return User::create($newuser); // return User::create($newuser);
} catch (\Exception $e) { // } catch (\Exception $e) {
$error = $e->getMessage(); // $error = $e->getMessage();
//
return response()->json(compact('error')); // return response()->json(compact('error'));
} // }
} // }
/** /**
* verify the url is existing or not. * verify the url is existing or not.

View File

@@ -53,7 +53,6 @@ class AuthController extends Controller
public function __construct(PhpMailController $PhpMailController) public function __construct(PhpMailController $PhpMailController)
{ {
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp();
$this->middleware('guest', ['except' => 'getLogout']); $this->middleware('guest', ['except' => 'getLogout']);
} }
@@ -186,6 +185,7 @@ class AuthController extends Controller
*/ */
public function postLogin(LoginRequest $request) public function postLogin(LoginRequest $request)
{ {
\Event::fire('auth.login.event', []); //added 5/5/2016
// Set login attempts and login time // Set login attempts and login time
$value = $_SERVER['REMOTE_ADDR']; $value = $_SERVER['REMOTE_ADDR'];
$usernameinput = $request->input('email'); $usernameinput = $request->input('email');
@@ -227,10 +227,10 @@ class AuthController extends Controller
$password = $request->input('password'); $password = $request->input('password');
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name'; $field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
// If attempts > 3 and time < 10 minutes // If attempts > 3 and time < 10 minutes
// if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60))) { if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60))) {
// //
// return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message); return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message);
// } }
// If time > 10 minutes, reset attempts counter and time in session // If time > 10 minutes, reset attempts counter and time in session
if (time() - $loginAttemptTime > ($security->lockout_period * 60)) { if (time() - $loginAttemptTime > ($security->lockout_period * 60)) {
\Session::put('loginAttempts', 1); \Session::put('loginAttempts', 1);
@@ -243,7 +243,7 @@ class AuthController extends Controller
} }
// If auth ok, redirect to restricted area // If auth ok, redirect to restricted area
\Session::put('loginAttempts', $loginAttempts + 1); \Session::put('loginAttempts', $loginAttempts + 1);
\Event::fire('auth.login.event', []); //added 5/5/2016
if (Auth::Attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) { if (Auth::Attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) {
if (Auth::user()->role == 'user') { if (Auth::user()->role == 'user') {
return \Redirect::route('/'); return \Redirect::route('/');
@@ -277,13 +277,15 @@ class AuthController extends Controller
if ($data) { if ($data) {
$attempts = $data->Attempts + 1; $attempts = $data->Attempts + 1;
if ($attempts == $apt) { if ($attempts == $apt) {
$result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'"); // $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'");
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts, 'LastLogin' => Date('Y-m-d H:i:s')]);
} else { } else {
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]); $result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]);
// $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'"); // $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'");
} }
} else { } else {
$result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())"); // $result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())");
$result = DB::table('login_attempts')->update(['Attempts' => 1, 'User' => $field, 'IP' => $value, 'LastLogin' => Date('Y-m-d H:i:s')]);
} }
} }
@@ -326,7 +328,6 @@ class AuthController extends Controller
return 1; return 1;
} else { } else {
$this->clearLoginAttempts($value, $field); $this->clearLoginAttempts($value, $field);
return 0; return 0;
} }
} }

View File

@@ -32,7 +32,6 @@ class PasswordController extends Controller
{ {
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
$this->middleware('guest'); $this->middleware('guest');
SettingsController::smtp();
} }
/** /**
@@ -54,6 +53,7 @@ class PasswordController extends Controller
{ {
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$this->validate($request, ['email' => 'required|email']); $this->validate($request, ['email' => 'required|email']);
\Event::fire('reset.password',array());
$user = User::where('email', '=', $request->only('email'))->first(); $user = User::where('email', '=', $request->only('email'))->first();
if (isset($user)) { if (isset($user)) {
$user1 = $user->email; $user1 = $user->email;
@@ -71,7 +71,7 @@ class PasswordController extends Controller
return redirect()->back()->with('status', Lang::get('lang.we_have_e-mailed_your_password_reset_link')); return redirect()->back()->with('status', Lang::get('lang.we_have_e-mailed_your_password_reset_link'));
} else { } else {
return redirect()->back()->with('errors', Lang::get("lang.we_can't_find_a_user_with_that_e-mail_address")); return redirect()->back()->with('fails', Lang::get("lang.we_can't_find_a_user_with_that_e-mail_address"));
} }
} }
} }

View File

@@ -327,18 +327,18 @@ class UserController extends Controller
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
if ($request->input('gender') == 1) { if ($request->input('gender') == 1) {
$name = 'avatar5.png'; $name = 'avatar5.png';
$destinationPath = 'lb-faveo/profilepic'; $destinationPath = 'uploads/profilepic';
$user->profile_pic = $name; $user->profile_pic = $name;
} elseif ($request->input('gender') == 0) { } elseif ($request->input('gender') == 0) {
$name = 'avatar2.png'; $name = 'avatar2.png';
$destinationPath = 'lb-faveo/profilepic'; $destinationPath = 'uploads/profilepic';
$user->profile_pic = $name; $user->profile_pic = $name;
} }
} }
if (Input::file('profile_pic')) { if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/profilepic'; $destinationPath = 'uploads/profilepic';
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);

View File

@@ -33,16 +33,15 @@ use Redirect;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormController extends Controller class FormController extends Controller {
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* Constructor to check. * Constructor to check.
* *
* @return void * @return void
*/ */
public function __construct(TicketWorkflowController $TicketWorkflowController) public function __construct(TicketWorkflowController $TicketWorkflowController) {
{
$this->middleware('board'); $this->middleware('board');
// creating a TicketController instance // creating a TicketController instance
$this->TicketWorkflowController = $TicketWorkflowController; $this->TicketWorkflowController = $TicketWorkflowController;
@@ -55,18 +54,21 @@ class FormController extends Controller
* *
* @return type * @return type
*/ */
public function getForm(Help_topic $topic, CountryCode $code) public function getForm(Help_topic $topic, CountryCode $code) {
{
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('license'); return \Redirect::route('licence');
} }
$location = GeoIP::getLocation(''); $location = GeoIP::getLocation('');
$phonecode = $code->where('iso', '=', $location['isoCode'])->first(); $phonecode = $code->where('iso', '=', $location['isoCode'])->first();
if (System::first()->status == 1) { if (System::first()->status == 1) {
$topics = $topic->get(); $topics = $topic->get();
$codes = $code->get(); $codes = $code->get();
if ($phonecode->phonecode) {
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode->phonecode); $phonecode = $phonecode->phonecode;
} else {
$phonecode = "";
}
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
} else { } else {
return \Redirect::route('home'); return \Redirect::route('home');
} }
@@ -80,46 +82,46 @@ class FormController extends Controller
* *
* @return type string * @return type string
*/ */
public function postForm($id, Help_topic $topic) public function postForm($id, Help_topic $topic) {
{
if ($id != 0) { if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first(); $helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form; $custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get(); $values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) { if (!$values) {
} }
if ($values) { if ($values) {
foreach ($values as $value) { foreach ($values as $form_data) {
if ($value->type == 'select') { if ($form_data->type == "select") {
$data = $value->value; $form_fields = explode(',', $form_data->value);
$value = explode(',', $data); $var = "";
echo '<select class="form-control">'; foreach ($form_fields as $form_field) {
foreach ($value as $option) { $var .= '<option value="' . $form_field . '">' . $form_field . '</option>';
echo '<option>'.$option.'</option>';
} }
echo '</select></br>'; echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>';
} elseif ($value->type == 'radio') { } elseif ($form_data->type == "radio") {
$type2 = $value->value; $type2 = $form_data->value;
$val = explode(',', $type2); $vals = explode(',', $type2);
echo '<label class="radio-inline">'.$value->label.'</label>&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp;&nbsp;'.$val[0].' echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp;&nbsp;'.$val[1].'</br>'; foreach ($vals as $val) {
} elseif ($value->type == 'textarea') { echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $val . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
$type3 = $value->value; }
$v = explode(',', $type3); echo "<br/>";
//dd($v); } elseif ($form_data->type == "textarea") {
if (array_key_exists(1, $v)) { $type3 = $form_data->value;
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>'; echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>';
} else { } elseif ($form_data->type == "checkbox") {
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>'; $type4 = $form_data->value;
$checks = explode(',', $type4);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
foreach ($checks as $check) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">&nbsp&nbsp' . $check;
} }
} elseif ($value->type == 'checkbox') {
$type4 = $value->value;
$check = explode(',', $type4);
echo '<label class="radio-inline">'.$value->label.'&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp&nbsp'.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">&nbsp&nbsp'.$check[1].'</label></br>';
} else { } else {
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>'; echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />';
} }
} }
echo '<br/><br/>';
} }
} else { } else {
return; return;
@@ -132,8 +134,7 @@ class FormController extends Controller
* @param type Request $request * @param type Request $request
* @param type User $user * @param type User $user
*/ */
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) {
{
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token'); $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
$name = $request->input('Name'); $name = $request->input('Name');
@@ -142,12 +143,16 @@ class FormController extends Controller
$subject = $request->input('Subject'); $subject = $request->input('Subject');
$details = $request->input('Details'); $details = $request->input('Details');
$phonecode = $request->input('Code'); $phonecode = $request->input('Code');
$System = System::where('id', '=', 1)->first();
$departments = Department::where('id', '=', $System->department)->first();
$department = $departments->id;
$mobile_number = $request->input('Mobile'); $mobile_number = $request->input('Mobile');
$status = $ticket_settings->first()->status; $status = $ticket_settings->first()->status;
$helptopic = $ticket_settings->first()->help_topic; $helptopic = $request->input('helptopic');
$helpTopicObj = Help_topic::where('id','=', $helptopic);
if($helpTopicObj->exists() && ($helpTopicObj->value('status')==1)){
$department = $helpTopicObj->value('department');
}else{
$defaultHelpTopicID = Ticket::where('id', '=', '1')->first()->help_topic;
$department = Help_topic::where('id','=', $defaultHelpTopicID)->value('department');
}
$sla = $ticket_settings->first()->sla; $sla = $ticket_settings->first()->sla;
$priority = $ticket_settings->first()->priority; $priority = $ticket_settings->first()->priority;
$source = $ticket_source->where('name', '=', 'web')->first()->id; $source = $ticket_source->where('name', '=', 'web')->first()->id;
@@ -161,8 +166,8 @@ class FormController extends Controller
$geoipcode = $code->where('iso', '=', $location['isoCode'])->first(); $geoipcode = $code->where('iso', '=', $location['isoCode'])->first();
if ($phonecode == null) { if ($phonecode == null) {
$data = [ $data = [
'fails' => Lang::get('lang.country-code-required-error'), 'fails' => Lang::get('lang.country-code-required-error'),
'phonecode' => $geoipcode->phonecode, 'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1, 'country_code_error' => 1,
]; ];
@@ -171,8 +176,8 @@ class FormController extends Controller
$code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get(); $code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get();
if (!count($code)) { if (!count($code)) {
$data = [ $data = [
'fails' => Lang::get('lang.incorrect-country-code-error'), 'fails' => Lang::get('lang.incorrect-country-code-error'),
'phonecode' => $geoipcode->phonecode, 'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1, 'country_code_error' => 1,
]; ];
@@ -197,9 +202,10 @@ class FormController extends Controller
} }
} }
} }
// dd($result);
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. '.Lang::get('lang.Please-save-this-for-future-reference')); return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ' . Lang::get('lang.Please-save-this-for-future-reference'));
} }
// dd($result);
} }
/** /**
@@ -209,14 +215,13 @@ class FormController extends Controller
* *
* @return type view * @return type view
*/ */
public function post_ticket_reply($id, Request $request) public function post_ticket_reply($id, Request $request) {
{
try { try {
if ($comment != null) { if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first(); $tickets = Tickets::where('id', '=', $id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first(); $thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
$subject = $thread->title.'[#'.$tickets->ticket_number.']'; $subject = $thread->title . '[#' . $tickets->ticket_number . ']';
$body = $request->input('comment'); $body = $request->input('comment');
$user_cred = User::where('id', '=', $tickets->user_id)->first(); $user_cred = User::where('id', '=', $tickets->user_id)->first();
@@ -248,29 +253,24 @@ class FormController extends Controller
} catch (Exception $e) { } catch (Exception $e) {
return \Redirect::back()->with('fails1', $e->getMessage()); return \Redirect::back()->with('fails1', $e->getMessage());
} }
//
// $comment = $request->input('comment');
// if ($comment != null) {
// $tickets = Tickets::where('id', '=', $id)->first();
// $threads = new Ticket_Thread();
// $tickets->closed_at = null;
// $tickets->closed = 0;
// $tickets->reopened_at = date('Y-m-d H:i:s');
// $tickets->reopened = 1;
// $threads->user_id = $tickets->user_id;
// $threads->ticket_id = $tickets->id;
// $threads->poster = 'client';
// $threads->body = $comment;
// try {
// $threads->save();
// $tickets->save();
//
// return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
// } catch (Exception $e) {
// return \Redirect::back()->with('fails1', $e->getMessage());
// }
// } else {
// return \Redirect::back()->with('fails1', Lang::get('lang.please_fill_some_data'));
// }
} }
}
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");
}
$custom_form = $helptopic->custom_form;
if ($custom_form) {
$fields = new Fields();
$forms = new \App\Model\helpdesk\Form\Forms();
$form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms);
$html = $form_controller->renderForm($custom_form);
}
return $html;
}
}

View File

@@ -16,6 +16,7 @@ use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Utility\CountryCode; use App\Model\helpdesk\Utility\CountryCode;
use App\Model\helpdesk\Settings\CommonSettings;
use App\User; use App\User;
use Auth; use Auth;
// classes // classes
@@ -76,18 +77,18 @@ class GuestController extends Controller
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
if ($request->input('gender') == 1) { if ($request->input('gender') == 1) {
$name = 'avatar5.png'; $name = 'avatar5.png';
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'uploads/profilepic';
$user->profile_pic = $name; $user->profile_pic = $name;
} elseif ($request->input('gender') == 0) { } elseif ($request->input('gender') == 0) {
$name = 'avatar2.png'; $name = 'avatar2.png';
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'uploads/profilepic';
$user->profile_pic = $name; $user->profile_pic = $name;
} }
} }
if (Input::file('profile_pic')) { if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'uploads/profilepic';
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
@@ -138,7 +139,7 @@ class GuestController extends Controller
public function getForm(Help_topic $topic) public function getForm(Help_topic $topic)
{ {
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('license'); return \Redirect::route('licence');
} }
if (System::first()->status == 1) { if (System::first()->status == 1) {
$topics = $topic->get(); $topics = $topic->get();
@@ -316,11 +317,13 @@ class GuestController extends Controller
* *
* @return type * @return type
*/ */
public function get_ticket_email($id) public function get_ticket_email($id, CommonSettings $common_settings)
{ {
$id1 = \Crypt::decrypt($id); $id1 = \Crypt::decrypt($id);
$common_setting = $common_settings->select('status')
return view('themes.default1.client.helpdesk.ckeckticket', compact('id')); ->where('option_name', '=', 'user_set_ticket_status')
->first();
return view('themes.default1.client.helpdesk.ckeckticket', compact('id', 'common_setting'));
} }
/** /**

View File

@@ -279,7 +279,7 @@ class UnAuthController extends Controller
return Lang::get('lang.your_ticket_has_been').' '.$ticket_status->state; return Lang::get('lang.your_ticket_has_been').' '.$ticket_status->state;
} }
//Auto-close tickets //Auto-close tickets
public function autoCloseTickets() public function autoCloseTickets()
{ {
$workflow = \App\Model\helpdesk\Workflow\WorkflowClose::whereId(1)->first(); $workflow = \App\Model\helpdesk\Workflow\WorkflowClose::whereId(1)->first();

View File

@@ -19,7 +19,7 @@ class WelcomepageController extends Controller
{ {
public function __construct() public function __construct()
{ {
// $this->middleware('board'); // $this->middleware('board');
} }
/** /**

View File

@@ -24,18 +24,10 @@ use Lang;
use Mail; use Mail;
use Redirect; use Redirect;
class UserController extends Controller class UserController extends Controller {
{
public function __construct() public function __construct() {
{
$this->middleware('board'); $this->middleware('board');
//$this->middleware('auth');
//SettingsController::language();
// $this->port();
// $this->host();
// $this->password();
// $this->encryption();
// $this->email();
} }
/** /**
@@ -43,23 +35,16 @@ class UserController extends Controller
* *
* @return response * @return response
*/ */
public function getArticle(Article $article, Category $category, Settings $settings) public function getArticle(Article $article, Category $category, Settings $settings) {
{ $setting = $settings->first();
$settings = $settings->first(); $pagination = $setting->pagination;
$pagination = $settings->pagination; if (\Auth::user()->role == 'user' || !Auth::check()) {
if (Auth::check()) {
if (\Auth::user()->role == 'user') {
$article = $article->where('status', '1');
}
} else {
$article = $article->where('status', '1'); $article = $article->where('status', '1');
} }
$article = $article->where('type', '1'); $article = $article->where('type', '1');
$article = $article->paginate($pagination); $article = $article->paginate($pagination);
// dd($article);
$article->setPath('article-list'); $article->setPath('article-list');
$categorys = $category->get(); $categorys = $category->get();
// $time = $this->timezone($utc);
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article')); return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
} }
@@ -72,8 +57,7 @@ class UserController extends Controller
* *
* @return string excerpt * @return string excerpt
*/ */
public static function getExcerpt($str, $startPos = 0, $maxLength = 50) public static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
{
if (strlen($str) > $maxLength) { if (strlen($str) > $maxLength) {
$excerpt = substr($str, $startPos, $maxLength - 3); $excerpt = substr($str, $startPos, $maxLength - 3);
$lastSpace = strrpos($excerpt, ' '); $lastSpace = strrpos($excerpt, ' ');
@@ -96,14 +80,13 @@ class UserController extends Controller
* *
* @return type view * @return type view
*/ */
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) {
{
$settings = $settings->first(); $settings = $settings->first();
$pagination = $settings->pagination; $pagination = $settings->pagination;
$search = $request->input('s'); $search = $request->input('s');
$result = $article->where('name', 'LIKE', '%'.$search.'%') $result = $article->where('name', 'LIKE', '%' . $search . '%')
->orWhere('slug', 'LIKE', '%'.$search.'%') ->orWhere('slug', 'LIKE', '%' . $search . '%')
->orWhere('description', 'LIKE', '%'.$search.'%') ->orWhere('description', 'LIKE', '%' . $search . '%')
->paginate($pagination); ->paginate($pagination);
$result->setPath('search'); $result->setPath('search');
$categorys = $category->get(); $categorys = $category->get();
@@ -116,34 +99,31 @@ class UserController extends Controller
* *
* @return response * @return response
*/ */
public function show($slug, Article $article, Category $category) public function show($slug, Article $article, Category $category) {
{
//ArticleController::timezone(); //ArticleController::timezone();
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone; $tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name; $tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
date_default_timezone_set($tz); date_default_timezone_set($tz);
$date = \Carbon\Carbon::now()->toDateTimeString(); $date = \Carbon\Carbon::now()->toDateTimeString();
$arti = $article->where('slug', $slug); $arti = $article->where('slug', $slug);
if (Auth::check()) {
if (\Auth::user()->role == 'user') { if (!Auth::check()|| \Auth::user()->role == 'user') {
$arti = $arti->where('status', '1');
}
} else {
$arti = $arti->where('status', '1'); $arti = $arti->where('status', '1');
$arti = $arti->where('publish_time', '<', $date);
} }
$arti = $arti->where('type', '1'); $arti = $arti->where('type', '1');
$arti = $arti->where('publish_time', '<', $date);
$arti = $arti->first(); $arti = $arti->first();
if ($arti) { if ($arti) {
return view('themes.default1.client.kb.article-list.show', compact('arti')); return view('themes.default1.client.kb.article-list.show', compact('arti'));
} else { } else {
return redirect()->back()->with('fails', Lang::get('lang.no_records_on_publish_time')); return redirect('404');
} }
} }
public function getCategory($slug, Article $article, Category $category, Relationship $relation) public function getCategory($slug, Article $article, Category $category, Relationship $relation) {
{
/* get the article_id where category_id == current category */ /* get the article_id where category_id == current category */
$catid = $category->where('slug', $slug)->first(); $catid = $category->where('slug', $slug)->first();
if (!$catid) { if (!$catid) {
@@ -159,8 +139,7 @@ class UserController extends Controller
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id')); return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
} }
public function home(Article $article, Category $category, Relationship $relation) public function home(Article $article, Category $category, Relationship $relation) {
{
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return redirect('step1'); return redirect('step1');
} else { } else {
@@ -172,8 +151,7 @@ class UserController extends Controller
} }
} }
public function Faq(Faq $faq, Category $category) public function Faq(Faq $faq, Category $category) {
{
$faq = $faq->where('id', '1')->first(); $faq = $faq->where('id', '1')->first();
$categorys = $category->get(); $categorys = $category->get();
@@ -185,8 +163,7 @@ class UserController extends Controller
* *
* @return response * @return response
*/ */
public function contact(Category $category, Settings $settings) public function contact(Category $category, Settings $settings) {
{
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
$categorys = $category->get(); $categorys = $category->get();
@@ -198,8 +175,7 @@ class UserController extends Controller
* *
* @return response * @return response
*/ */
public function postContact(ContactRequest $request, Contact $contact) public function postContact(ContactRequest $request, Contact $contact) {
{
$this->port(); $this->port();
$this->host(); $this->host();
$this->encryption(); $this->encryption();
@@ -217,8 +193,8 @@ class UserController extends Controller
//echo $message; //echo $message;
//echo $contact->email; //echo $contact->email;
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) { $mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) {
$message->to($contact->email, $contact->name)->subject('Contact'); $message->to($contact->email, $contact->name)->subject('Contact');
}); });
if ($mail) { if ($mail) {
return redirect('contact')->with('success', Lang::get('lang.your_details_send_to_system')); return redirect('contact')->with('success', Lang::get('lang.your_details_send_to_system'));
} else { } else {
@@ -226,8 +202,7 @@ class UserController extends Controller
} }
} }
public function contactDetails() public function contactDetails() {
{
return view('themes.default1.client.kb.article-list.contact-details'); return view('themes.default1.client.kb.article-list.contact-details');
} }
@@ -241,9 +216,11 @@ class UserController extends Controller
* *
* @return type response * @return type response
*/ */
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
{
$article = $article->where('slug', $slug)->first(); $article = $article->where('slug', $slug)->first();
if(!$article){
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
}
$id = $article->id; $id = $article->id;
$comment->article_id = $id; $comment->article_id = $id;
if ($comment->fill($request->input())->save()) { if ($comment->fill($request->input())->save()) {
@@ -253,46 +230,42 @@ class UserController extends Controller
} }
} }
public function getPage($name, Page $page) public function getPage($name, Page $page) {
{
$page = $page->where('slug', $name)->first(); $page = $page->where('slug', $name)->first();
//$this->timezone($page->created_at); if($page){
return view('themes.default1.client.kb.article-list.pages', compact('page')); return view('themes.default1.client.kb.article-list.pages', compact('page'));
}else{
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
}
} }
public static function port() public static function port() {
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set('mail.port', $setting->port); Config::set('mail.port', $setting->port);
} }
public static function host() public static function host() {
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set('mail.host', $setting->host); Config::set('mail.host', $setting->host);
} }
public static function encryption() public static function encryption() {
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]); Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
} }
public static function email() public static function email() {
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]); Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
//dd(Config::get('mail')); //dd(Config::get('mail'));
} }
public static function password() public static function password() {
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]); Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
} }
public function getCategoryList(Article $article, Category $category, Relationship $relation) public function getCategoryList(Article $article, Category $category, Relationship $relation) {
{
//$categorys = $category->get(); //$categorys = $category->get();
$categorys = $category->get(); $categorys = $category->get();
// $categorys->setPath('home'); // $categorys->setPath('home');
@@ -314,15 +287,13 @@ class UserController extends Controller
// //return substr($date, 0, -6); // //return substr($date, 0, -6);
// } // }
public function clientProfile() public function clientProfile() {
{
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.client.kb.article-list.profile', compact('user')); return view('themes.default1.client.kb.article-list.profile', compact('user'));
} }
public function postClientProfile($id, ProfileRequest $request) public function postClientProfile($id, ProfileRequest $request) {
{
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
@@ -341,7 +312,7 @@ class UserController extends Controller
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999) . '.' . $name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
@@ -355,8 +326,7 @@ class UserController extends Controller
} }
} }
public function postClientProfilePassword($id, ProfilePassword $request) public function postClientProfilePassword($id, ProfilePassword $request) {
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
@@ -368,4 +338,5 @@ class UserController extends Controller
return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated')); return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated'));
} }
} }
} }

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers\Common;
use App\Http\Controllers\Controller;
class FileuploadController extends Controller {
public function __construct() {
// checking authentication
$this->middleware('auth');
// checking if role is agent
$this->middleware('role.agent');
}
// Returns a file size limit in bytes based on the PHP upload_max_filesize
// and post_max_size
function file_upload_max_size() {
static $max_size = -1;
if ($max_size < 0) {
// Start with post_max_size.
$max_size_in_bytes = $this->parse_size(ini_get('post_max_size'));
$max_size_in_actual = ini_get('post_max_size');
// If upload_max_size is less, then reduce. Except if upload_max_size is
// zero, which indicates no limit.
$upload_max = $this->parse_size(ini_get('upload_max_filesize'));
if ($upload_max > 0 && $upload_max < $max_size) {
$max_size_in_bytes = $upload_max;
$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) {
$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) {
// Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
} else {
return round($size);
}
}
}

View File

@@ -5,84 +5,110 @@ namespace App\Http\Controllers\Common;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Model\helpdesk\Notification\Notification; use App\Model\helpdesk\Notification\Notification;
use App\Model\helpdesk\Notification\UserNotification; use App\Model\helpdesk\Notification\UserNotification;
use App\Model\helpdesk\Ticket\Tickets;
use App\User; use App\User;
use App\Http\Controllers\Api\v1\PushNotificationController;
use App\Model\helpdesk\Notification\NotificationType;
class NotificationController extends Controller class NotificationController extends Controller {
{ /**
*********************************************
* Class Notification Controller
*********************************************
* This controller is used to generate in app notification
* under the folling occurrence
* 1. Ticket Creation
* 2. Ticket Reply
* 3. User Creation
*
* @author Ladybird <info@ladybirdweb.com>
*/
public $user; public $user;
public function __construct() /**
{ * Constructor
*/
public function __construct(PushNotificationController $PushNotificationController) {
$this->PushNotificationController = $PushNotificationController;
$user = new User(); $user = new User();
$this->user = $user; $this->user = $user;
// checking authentication
$this->middleware('auth');
// checking if role is agent
$this->middleware('role.agent');
} }
/** /**
* get the page to list the notifications. * This function is used to create in app notifications.
* * @param type $model_id
* @return response * @param type $userid_created
* @param type $type_id
* @param type $forwhome
*/ */
public static function getNotifications() public function create($model_id, $userid_created, $type_id, $forwhome = []) {
{
$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;
}
public function create($model_id, $userid_created, $type_id, $forwhome = [])
{
try { try {
if (empty($forwhome)) { if (empty($forwhome)) {
$forwhome = $this->user->where('role', '!=', 'user')->get()->toArray(); $ticket = Tickets::where('id', '=', $model_id)->first();
$forwhome = $this->user->where('role', '=', 'agent')->where('primary_dpt', '=', $ticket->dept_id)->get();
$forwhome2 = $this->user->where('role', '=', 'admin')->get();
$forwhome = $forwhome->merge($forwhome2);
} }
//dd($forwhome); // system notification
//system notification $notify = Notification::create(['model_id' => $model_id, 'userid_created' => $userid_created, 'type_id' => $type_id]);
$notification = new Notification();
$UN = new UserNotification();
$notify = $notification->create(['model_id' => $model_id, 'userid_created' => $userid_created, 'type_id' => $type_id]);
foreach ($forwhome as $agent) { foreach ($forwhome as $agent) {
$user_notify = $UN->create(['notification_id' => $notify->id, 'user_id' => $agent['id'], 'is_read' => 0]); $type_message = NotificationType::where('id', '=', $type_id)->first();
UserNotification::create(['notification_id' => $notify->id, 'user_id' => $agent['id'], 'is_read' => 0]);
// $this->PushNotificationController->response($agent->fcm_token, $type_message->message . $model_id, $model_id);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
} }
public function markAllRead($id) /**
{ * This function is to mark all ticket to read status
* @param type $id
* @return int
*/
public function markAllRead($id) {
$markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get(); $markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) { foreach ($markasread as $mark) {
$mark->is_read = '1'; $mark->is_read = '1';
$mark->save(); $mark->save();
} }
return 1; return 1;
} }
public function markRead($id) /**
{ * This function to mark read
* @param type $id
* @return int
*/
public function markRead($id) {
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get(); $markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) { foreach ($markasread as $mark) {
$mark->is_read = '1'; $mark->is_read = '1';
$mark->save(); $mark->save();
} }
return 1; return 1;
} }
public function show() /**
{ * function to show all the notifications
* @return type
*/
public function show() {
$notifications = $this->getNotifications(); $notifications = $this->getNotifications();
return view('notifications-all', compact('notifications')); return view('notifications-all', compact('notifications'));
} }
public function delete($id) /**
{ * function to delete notifications
* @param type $id
* @return int
*/
public function delete($id) {
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get(); $markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get();
foreach ($markasread as $mark) { foreach ($markasread as $mark) {
$mark->delete(); $mark->delete();
@@ -90,4 +116,17 @@ class NotificationController extends Controller
return 1; return 1;
} }
/**
* get the page to list the notifications.
* @return response
*/
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

@@ -8,15 +8,14 @@ use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Settings\CommonSettings;
use App\User; use App\User;
use Auth; use Auth;
class PhpMailController extends Controller class PhpMailController extends Controller {
{
public function fetch_smtp_details($id)
{
$emails = Emails::where('id', '=', $id)->first();
public function fetch_smtp_details($id) {
$emails = Emails::where('id', '=', $id)->first();
return $emails; return $emails;
} }
@@ -25,269 +24,266 @@ class PhpMailController extends Controller
* *
* @return Mail * @return Mail
*/ */
public function sendmail($from, $to, $message, $template_variables) public function sendmail($from, $to, $message, $template_variables) {
{ // try {
// dd($from); // dd($from);
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
if ($from_address == null) { if ($from_address == null) {
return $from_address; return $from_address;
} else { } else {
// dd($from_address); // dd($from_address);
$username = $from_address->email_address; $username = $from_address->email_address;
$fromname = $from_address->email_name; $fromname = $from_address->email_name;
$password = \Crypt::decrypt($from_address->password); $password = \Crypt::decrypt($from_address->password);
$smtpsecure = $from_address->sending_encryption; $smtpsecure = $from_address->sending_encryption;
$host = $from_address->sending_host; $host = $from_address->sending_host;
$port = $from_address->sending_port; $port = $from_address->sending_port;
$protocol = $from_address->sending_protocol; $protocol = $from_address->sending_protocol;
if (isset($to['email'])) { if (isset($to['email'])) {
$recipants = $to['email']; $recipants = $to['email'];
} else { } else {
$recipants = null; $recipants = null;
} }
if (isset($to['name'])) { if (isset($to['name'])) {
$recipantname = $to['name']; $recipantname = $to['name'];
} else { } else {
$recipantname = null; $recipantname = null;
} }
if (isset($to['cc'])) { if (isset($to['cc'])) {
$cc = $to['cc']; $cc = $to['cc'];
} else { } else {
$cc = null; $cc = null;
} }
if (isset($to['bc'])) { if (isset($to['bc'])) {
$bc = $to['bc']; $bc = $to['bc'];
} else { } else {
$bc = null; $bc = null;
} }
// if (isset($message['subject'])) { // if (isset($message['subject'])) {
// $subject = $message['subject']; // $subject = $message['subject'];
// } else { // } else {
// $subject = null; // $subject = null;
// } // }
if (isset($message['body'])) { if (isset($message['body'])) {
$content = $message['body']; $content = $message['body'];
} else { } else {
$content = null; $content = null;
} }
if (isset($message['scenario'])) { if (isset($message['scenario'])) {
$template = $message['scenario']; $template = $message['scenario'];
} else { } else {
$template = null; $template = null;
} }
if (isset($message['attachments'])) { if (isset($message['attachments'])) {
$attachment = $message['attachments']; $attachment = $message['attachments'];
} else { } else {
$attachment = null; $attachment = null;
} }
// template variables // template variables
if (Auth::user()) { if (Auth::user()) {
$agent = Auth::user()->user_name; $agent = Auth::user()->user_name;
} else { } else {
$agent = null; $agent = null;
} }
if (isset($template_variables['ticket_agent_name'])) { if (isset($template_variables['ticket_agent_name'])) {
$ticket_agent_name = $template_variables['ticket_agent_name']; $ticket_agent_name = $template_variables['ticket_agent_name'];
} else { } else {
$ticket_agent_name = null; $ticket_agent_name = null;
} }
if (isset($template_variables['ticket_number'])) { if (isset($template_variables['ticket_number'])) {
$ticket_number = $template_variables['ticket_number']; $ticket_number = $template_variables['ticket_number'];
} else { } else {
$ticket_number = null; $ticket_number = null;
} }
if (isset($template_variables['ticket_client_name'])) { if (isset($template_variables['ticket_client_name'])) {
$ticket_client_name = $template_variables['ticket_client_name']; $ticket_client_name = $template_variables['ticket_client_name'];
} else { } else {
$ticket_client_name = null; $ticket_client_name = null;
} }
if (isset($template_variables['ticket_client_email'])) { if (isset($template_variables['ticket_client_email'])) {
$ticket_client_email = $template_variables['ticket_client_email']; $ticket_client_email = $template_variables['ticket_client_email'];
} else { } else {
$ticket_client_email = null; $ticket_client_email = null;
} }
if (isset($template_variables['ticket_body'])) { if (isset($template_variables['ticket_body'])) {
$ticket_body = $template_variables['ticket_body']; $ticket_body = $template_variables['ticket_body'];
} else { } else {
$ticket_body = null; $ticket_body = null;
} }
if (isset($template_variables['ticket_assigner'])) { if (isset($template_variables['ticket_assigner'])) {
$ticket_assigner = $template_variables['ticket_assigner']; $ticket_assigner = $template_variables['ticket_assigner'];
} else { } else {
$ticket_assigner = null; $ticket_assigner = null;
} }
if (isset($template_variables['ticket_link_with_number'])) { if (isset($template_variables['ticket_link_with_number'])) {
$ticket_link_with_number = $template_variables['ticket_link_with_number']; $ticket_link_with_number = $template_variables['ticket_link_with_number'];
} else { } else {
$ticket_link_with_number = null; $ticket_link_with_number = null;
} }
// if (isset($template_variables['system_from'])) { if (isset($template_variables['system_from'])) {
// $system_from = $template_variables['system_from']; $system_from = $template_variables['system_from'];
// } else { } else {
// $system_from = null; $system_from = $this->company();
// } }
if (isset($template_variables['system_link'])) { if (isset($template_variables['system_link'])) {
$system_link = $template_variables['system_link']; $system_link = $template_variables['system_link'];
} else { } else {
$system_link = null; $system_link = url('/');
} }
if (isset($template_variables['system_error'])) { if (isset($template_variables['system_error'])) {
$system_error = $template_variables['system_error']; $system_error = $template_variables['system_error'];
} else { } else {
$system_error = null; $system_error = null;
} }
if (isset($template_variables['agent_sign'])) { if (isset($template_variables['agent_sign'])) {
$agent_sign = $template_variables['agent_sign']; $agent_sign = $template_variables['agent_sign'];
} else { } else {
$agent_sign = null; $agent_sign = null;
} }
if (isset($template_variables['department_sign'])) { if (isset($template_variables['department_sign'])) {
$department_sign = $template_variables['department_sign']; $department_sign = $template_variables['department_sign'];
} else { } else {
$department_sign = null; $department_sign = null;
} }
if (isset($template_variables['password_reset_link'])) { if (isset($template_variables['password_reset_link'])) {
$password_reset_link = $template_variables['password_reset_link']; $password_reset_link = $template_variables['password_reset_link'];
} else { } else {
$password_reset_link = null; $password_reset_link = null;
} }
if (isset($template_variables['user_password'])) { if (isset($template_variables['user_password'])) {
$user_password = $template_variables['user_password']; $user_password = $template_variables['user_password'];
} else { } else {
$user_password = null; $user_password = null;
} }
if (isset($template_variables['email_address'])) { if (isset($template_variables['email_address'])) {
$email_address = $template_variables['email_address']; $email_address = $template_variables['email_address'];
} else { } else {
$email_address = null; $email_address = null;
} }
if (isset($template_variables['user'])) { if (isset($template_variables['user'])) {
$user = $template_variables['user']; $user = $template_variables['user'];
} else { } else {
$user = null; $user = null;
} }
$system_link = url('/'); // $system_link = url('/');
$system_from = $this->company(); // $system_from = $this->company();
$mail = new \PHPMailer(); $mail = new \PHPMailer();
$status = \DB::table('settings_email')->first(); $status = \DB::table('settings_email')->first();
$path2 = \Config::get('view.paths'); $path2 = \Config::get('view.paths');
// $directory = $path2[0].DIRECTORY_SEPARATOR.'emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR; // $directory = $path2[0].DIRECTORY_SEPARATOR.'emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
// //
// $handle = fopen($directory.$template.'.blade.php', 'r'); // $handle = fopen($directory.$template.'.blade.php', 'r');
// $contents = fread($handle, filesize($directory.$template.'.blade.php')); // $contents = fread($handle, filesize($directory.$template.'.blade.php'));
// fclose($handle); // fclose($handle);
$template = TemplateType::where('name', '=', $template)->first(); $template = TemplateType::where('name', '=', $template)->first();
$set = \App\Model\Common\TemplateSet::where('name', '=', $status->template)->first(); $set = \App\Model\Common\TemplateSet::where('name', '=', $status->template)->first();
if (isset($set['id'])) { if (isset($set['id'])) {
$template_data = \App\Model\Common\Template::where('set_id', '=', $set->id)->where('type', '=', $template->id)->first(); $template_data = \App\Model\Common\Template::where('set_id', '=', $set->id)->where('type', '=', $template->id)->first();
$contents = $template_data->message; $contents = $template_data->message;
if ($template_data->variable == 1) { if ($template_data->variable == 1) {
if ($template_data->subject) { if ($template_data->subject) {
$subject = $template_data->subject; $subject = $template_data->subject;
if ($ticket_number != null) { if ($ticket_number != null) {
$subject = $subject.' [#'.$ticket_number.']'; $subject = $subject . ' [#' . $ticket_number . ']';
}
} else {
$subject = $message['subject'];
} }
} else { } else {
$subject = $message['subject']; $subject = $message['subject'];
} }
} else { } else {
$subject = $message['subject']; $contents = null;
$subject = null;
} }
} else {
$contents = null;
$subject = null;
}
$variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}']; $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}'];
$data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link]; $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link];
// dd($variables,$data,$contents); // dd($variables,$data,$contents);
// $messagebody = str_replace($variables, $data, $contents); // $messagebody = str_replace($variables, $data, $contents);
foreach ($variables as $key => $variable) {
$messagebody = str_replace($variables[$key], $data[$key], $contents);
// dd($messagebody);
$contents = $messagebody;
}
foreach ($variables as $key => $variable) {
$messagebody = str_replace($variables[$key], $data[$key], $contents);
// dd($messagebody); // dd($messagebody);
//$mail->SMTPDebug = 3; // Enable verbose debug output
$contents = $messagebody; if ($protocol == 'smtp') {
} $mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = $host; // Specify main and backup SMTP servers
// dd($messagebody); $mail->SMTPAuth = true; // Enable SMTP authentication
//$mail->SMTPDebug = 3; // Enable verbose debug output $mail->Username = $username; // SMTP username
if ($protocol == 'smtp') { $mail->Password = $password; // SMTP password
$mail->isSMTP(); // Set mailer to use SMTP $mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted
$mail->Host = $host; // Specify main and backup SMTP servers $mail->Port = $port; // TCP port to connect to
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $username; // SMTP username
$mail->Password = $password; // SMTP password
$mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted
$mail->Port = $port; // TCP port to connect to
$mail->setFrom($username, $fromname);
} elseif ($protocol == 'mail') {
$mail->IsSendmail(); // telling the class to use SendMail transport
if ($username == $fromname) {
$mail->setFrom($username);
} else {
$mail->setFrom($username, $fromname); $mail->setFrom($username, $fromname);
} elseif ($protocol == 'mail') {
$mail->IsSendmail(); // telling the class to use SendMail transport
if ($username == $fromname) {
$mail->setFrom($username);
} else {
$mail->setFrom($username, $fromname);
}
}
$mail->addAddress($recipants); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
if ($cc != null) {
foreach ($cc as $collaborator) {
//mail to collaborators
$collab_user_id = $collaborator->user_id;
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
$collab_email = $user_id_collab->email;
$mail->addCC($collab_email);
}
}
if ($attachment != null) {
$size = count($message['attachments']);
$attach = $message['attachments'];
for ($i = 0; $i < $size; $i++) {
$file_path = $attach[$i]->getRealPath();
$file_name = $attach[$i]->getClientOriginalName();
$mail->addAttachment($file_path, $file_name);
}
}
$mail->CharSet = "utf8";
$mail->Subject = $subject;
if ($template == 'ticket-reply-agent') {
$line = '---Reply above this line--- <br/><br/>';
$body = $line . $messagebody;
} else {
$body = $messagebody;
}
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
if($rtl->option_value == 1) {
$mail->ContentType = 'text/html';
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>';
} else {
}
$mail->Body = nl2br($body);
if (!$mail->send()) {
return;
} else {
return 1;
} }
} }
$mail->addAddress($recipants); // Add a recipient
// Name is optional
// $mail->addReplyTo('sada059@gmail.com', 'Information');
// Optional name
$mail->isHTML(true); // Set email format to HTML
if ($cc != null) {
foreach ($cc as $collaborator) {
//mail to collaborators
$collab_user_id = $collaborator->user_id;
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
$collab_email = $user_id_collab->email;
$mail->addCC($collab_email);
}
}
// $mail->addBCC($bc);
if ($attachment != null) {
$size = count($message['attachments']);
$attach = $message['attachments'];
for ($i = 0; $i < $size; $i++) {
$file_path = $attach[$i]->getRealPath();
$file_name = $attach[$i]->getClientOriginalName();
$mail->addAttachment($file_path, $file_name);
}
}
$mail->Subject = utf8_decode($subject);
if ($template == 'ticket-reply-agent') {
$line = '---Reply above this line--- <br/><br/>';
$mail->Body = utf8_decode($line.$messagebody);
} else {
$mail->Body = utf8_decode($messagebody);
}
// $mail->AltBody = $altbody;
if (!$mail->send()) {
return;
// echo 'Message could not be sent.';
// echo 'Mailer Error: '.$mail->ErrorInfo;
} else {
return 1;
// echo 'Message has been sent';
}
}
} }
/** /**
@@ -295,123 +291,129 @@ class PhpMailController extends Controller
* *
* @return MailNotification * @return MailNotification
*/ */
public function sendEmail($from, $to, $message) public function sendEmail($from, $to, $message) {
{ try {
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
if ($from_address == null) {
return $from_address;
} else {
$username = $from_address->email_address;
$fromname = $from_address->email_name;
$password = \Crypt::decrypt($from_address->password);
$smtpsecure = $from_address->sending_encryption;
$host = $from_address->sending_host;
$port = $from_address->sending_port;
$protocol = $from_address->sending_protocol;
$username = $from_address->email_address; if (isset($to['email'])) {
$fromname = $from_address->email_name; $recipants = $to['email'];
$password = \Crypt::decrypt($from_address->password); } else {
$smtpsecure = $from_address->sending_encryption; $recipants = null;
$host = $from_address->sending_host; }
$port = $from_address->sending_port; if (isset($to['name'])) {
$recipantname = $to['name'];
} else {
$recipantname = null;
}
if (isset($to['cc'])) {
$cc = $to['cc'];
} else {
$cc = null;
}
if (isset($to['bc'])) {
$bc = $to['bc'];
} else {
$bc = null;
}
if (isset($message['subject'])) {
$subject = $message['subject'];
} else {
$subject = null;
}
if (isset($message['body'])) {
$content = $message['body'];
} else {
$content = null;
}
if (isset($message['scenario'])) {
$template = $message['scenario'];
} else {
$template = null;
}
if (isset($message['attachments'])) {
$attachment = $message['attachments'];
} else {
$attachment = null;
}
if (isset($to['email'])) { // template variables
$recipants = $to['email']; if (Auth::user()) {
} else { $agent = Auth::user()->user_name;
$recipants = null; } else {
} $agent = null;
if (isset($to['name'])) { }
$recipantname = $to['name'];
} else {
$recipantname = null;
}
if (isset($to['cc'])) {
$cc = $to['cc'];
} else {
$cc = null;
}
if (isset($to['bc'])) {
$bc = $to['bc'];
} else {
$bc = null;
}
if (isset($message['subject'])) {
$subject = $message['subject'];
} else {
$subject = null;
}
if (isset($message['body'])) {
$content = $message['body'];
} else {
$content = null;
}
if (isset($message['scenario'])) {
$template = $message['scenario'];
} else {
$template = null;
}
if (isset($message['attachments'])) {
$attachment = $message['attachments'];
} else {
$attachment = null;
}
// template variables $system_link = url('/');
if (Auth::user()) {
$agent = Auth::user()->user_name;
} else {
$agent = null;
}
$system_link = url('/'); $system_from = $this->company();
$system_from = $this->company(); $mail = new \PHPMailer();
$mail = new \PHPMailer(); $status = \DB::table('settings_email')->first();
$status = \DB::table('settings_email')->first(); // dd($messagebody);
//$mail->SMTPDebug = 3; // Enable verbose debug output
// dd($messagebody); if ($protocol == 'smtp') {
//$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = $host; // Specify main and backup SMTP servers
$mail->isSMTP(); // Set mailer to use SMTP $mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Host = $host; // Specify main and backup SMTP servers $mail->Username = $username; // SMTP username
$mail->SMTPAuth = true; // Enable SMTP authentication $mail->Password = $password; // SMTP password
$mail->Username = $username; // SMTP username $mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted
$mail->Password = $password; // SMTP password $mail->Port = $port; // TCP port to connect to
$mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted $mail->setFrom($username, $fromname);
$mail->Port = $port; // TCP port to connect to } elseif ($protocol == 'mail') {
$mail->IsSendmail(); // telling the class to use SendMail transport
$mail->setFrom($username, $fromname); if ($username == $fromname) {
$mail->addAddress($recipants); // Add a recipient $mail->setFrom($username);
// Name is optional } else {
// $mail->addReplyTo('sada059@gmail.com', 'Information'); $mail->setFrom($username, $fromname);
// Optional name }
$mail->isHTML(true); // Set email format to HTML }
if ($cc != null) { $mail->addAddress($recipants); // Add a recipient
foreach ($cc as $collaborator) { // Name is optional
//mail to collaborators // $mail->addReplyTo('sada059@gmail.com', 'Information');
$collab_user_id = $collaborator->user_id; // Optional name
$user_id_collab = User::where('id', '=', $collab_user_id)->first(); $mail->isHTML(true); // Set email format to HTML
$collab_email = $user_id_collab->email; if ($cc != null) {
$mail->addCC($collab_email); foreach ($cc as $collaborator) {
//mail to collaborators
$collab_user_id = $collaborator->user_id;
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
$collab_email = $user_id_collab->email;
$mail->addCC($collab_email);
}
}
if ($attachment != null) {
$size = count($message['attachments']);
$attach = $message['attachments'];
for ($i = 0; $i < $size; $i++) {
$file_path = $attach[$i]->getRealPath();
$file_name = $attach[$i]->getClientOriginalName();
$mail->addAttachment($file_path, $file_name);
}
}
$mail->CharSet = "utf8";
$mail->Subject = $subject;
$mail->Body = $content;
if (!$mail->send()) {
} else {
}
} }
} } catch (Exception $e) {
if($e instanceof ErrorException) {
$mail->addBCC($bc); return \Lang::get('lang.outgoing_email_failed');
}
if ($attachment != null) {
$size = count($message['attachments']);
$attach = $message['attachments'];
for ($i = 0; $i < $size; $i++) {
$file_path = $attach[$i]->getRealPath();
$file_name = $attach[$i]->getClientOriginalName();
$mail->addAttachment($file_path, $file_name);
}
}
$mail->Subject = utf8_decode($subject);
$mail->Body = utf8_decode($content);
// $mail->AltBody = $altbody;
if (!$mail->send()) {
// echo 'Message could not be sent.';
// echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
// echo 'Message has been sent';
} }
} }
@@ -420,8 +422,7 @@ class PhpMailController extends Controller
* *
* @return type * @return type
*/ */
public function company() public function company() {
{
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = 'Support Center'; $company = 'Support Center';
@@ -440,8 +441,7 @@ class PhpMailController extends Controller
* *
* @return type integer * @return type integer
*/ */
public function mailfrom($reg, $dept_id) public function mailfrom($reg, $dept_id) {
{
$email = Email::where('id', '=', '1')->first(); $email = Email::where('id', '=', '1')->first();
if ($reg == 1) { if ($reg == 1) {
return $email->sys_email; return $email->sys_email;
@@ -454,4 +454,5 @@ class PhpMailController extends Controller
} }
} }
} }
}
}

View File

@@ -0,0 +1,43 @@
<?php
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;
use FCM;
use FCMGroup;
/**
* **********************************************
* PushNotificationController
* **********************************************
* This controller is used to send notification to FCM cloud which later will
* foreward notification to Mobile Application
*
* @author Ladybird <info@ladybirdweb.com>
*/
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) {
}
}

View File

@@ -27,25 +27,16 @@ use Lang;
* *************************** * ***************************
* Controller to keep smtp details and fetch where ever needed. * Controller to keep smtp details and fetch where ever needed.
*/ */
class SettingsController extends Controller class SettingsController extends Controller {
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @return type void * @return type void
*/ */
public function __construct() public function __construct() {
{
// $this->smtp();
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
// self::driver();
// self::host();
// self::port();
// self::from();
// self::encryption();
// self::username();
// self::password();
} }
/** /**
@@ -53,8 +44,7 @@ class SettingsController extends Controller
* *
* @return response * @return response
*/ */
public function widgets() public function widgets() {
{
return view('themes.default1.admin.helpdesk.theme.widgets'); return view('themes.default1.admin.helpdesk.theme.widgets');
} }
@@ -63,8 +53,7 @@ class SettingsController extends Controller
* *
* @return response * @return response
*/ */
public function list_widget() public function list_widget() {
{
return \Datatable::collection(Widgets::where('id', '<', '7')->get()) return \Datatable::collection(Widgets::where('id', '<', '7')->get())
->searchColumns('name') ->searchColumns('name')
->orderColumns('name', 'title', 'value') ->orderColumns('name', 'title', 'value')
@@ -78,33 +67,33 @@ class SettingsController extends Controller
return $model->value; return $model->value;
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span> return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
<div class="modal fade" id="edit_widget'.$model->id.'"> <div class="modal fade" id="edit_widget' . $model->id . '">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="'.url('edit-widget/'.$model->id).'" method="POST"> <form action="' . url('edit-widget/' . $model->id) . '" method="POST">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">'.strtoupper($model->name).' </h4> <h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>'.\Lang::get('lang.title').'</label><br/> <label>' . \Lang::get('lang.title') . '</label><br/>
<input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%"> <input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%">
</div> </div>
<br/> <br/>
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>'.\Lang::get('lang.content').'</label><br/> <label>' . \Lang::get('lang.content') . '</label><br/>
<textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea> <textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'"> <input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
</div> </div>
<script> <script>
$(function () { $(function () {
$("#Content'.$model->id.'").wysihtml5(); $("#Content' . $model->id . '").wysihtml5();
}); });
</script> </script>
</form> </form>
@@ -123,15 +112,13 @@ class SettingsController extends Controller
* *
* @return type response * @return type response
*/ */
public function edit_widget($id, Widgets $widgets, Request $request) public function edit_widget($id, Widgets $widgets, Request $request) {
{
$widget = $widgets->where('id', '=', $id)->first(); $widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title; $widget->title = $request->title;
$widget->value = $request->content; $widget->value = $request->content;
try { try {
$widget->save(); $widget->save();
return redirect()->back()->with('success', $widget->name . Lang::get('lang.saved_successfully'));
return redirect()->back()->with('success', $widget->name.Lang::get('lang.saved_successfully'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());
} }
@@ -142,8 +129,7 @@ class SettingsController extends Controller
* *
* @return response * @return response
*/ */
public function social_buttons() public function social_buttons() {
{
return view('themes.default1.admin.helpdesk.theme.social'); return view('themes.default1.admin.helpdesk.theme.social');
} }
@@ -152,8 +138,7 @@ class SettingsController extends Controller
* *
* @return response * @return response
*/ */
public function list_social_buttons() public function list_social_buttons() {
{
return \Datatable::collection(Widgets::where('id', '>', '6')->get()) return \Datatable::collection(Widgets::where('id', '>', '6')->get())
->searchColumns('name') ->searchColumns('name')
->orderColumns('name', 'value') ->orderColumns('name', 'value')
@@ -164,25 +149,25 @@ class SettingsController extends Controller
return $model->value; return $model->value;
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span> return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
<div class="modal fade" id="edit_widget'.$model->id.'"> <div class="modal fade" id="edit_widget' . $model->id . '">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="'.url('edit-widget/'.$model->id).'" method="POST"> <form action="' . url('edit-widget/' . $model->id) . '" method="POST">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">'.strtoupper($model->name).' </h4> <h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<br/> <br/>
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>'.\Lang::get('lang.link').'</label><br/> <label>' . \Lang::get('lang.link') . '</label><br/>
<input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'"> <input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '">
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'"> <input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
</div> </div>
</form> </form>
</div> </div>
@@ -200,116 +185,26 @@ class SettingsController extends Controller
* *
* @return type response * @return type response
*/ */
public function edit_social_buttons($id, Widgets $widgets, Request $request) public function edit_social_buttons($id, Widgets $widgets, Request $request) {
{
$widget = $widgets->where('id', '=', $id)->first(); $widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title; $widget->title = $request->title;
$widget->value = $request->content; $widget->value = $request->content;
try { try {
$widget->save(); $widget->save();
return redirect()->back()->with('success', $widget->name.' Saved Successfully'); return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
} }
/**
* Driver.
*
* @return type void
*/
public static function driver()
{
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->driver);
}
/**
* SMTP host.
*
* @return type void
*/
public static function host()
{
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->host);
}
/**
* SMTP port.
*
* @return type void
*/
public static function port()
{
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.port', intval($settings->port));
}
/**
* SMTP from.
*
* @return type void
*/
public static function from()
{
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]);
}
/**
* SMTP encryption.
*
* @return type void
*/
public static function encryption()
{
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.encryption', $settings->encryption);
}
/**
* SMTP username.
*
* @return type void
*/
public static function username()
{
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.username', $settings->email);
}
/**
* SMTP password.
*
* @return type void
*/
public static function password()
{
$settings = Smtp::first();
if ($settings->password) {
$pass = $settings->password;
$password = Crypt::decrypt($pass);
Config::set('mail.password', $password);
}
}
/** /**
* get SMTP. * get SMTP.
* *
* @return type view * @return type view
*/ */
public function getsmtp() public function getsmtp() {
{
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings')); return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
} }
@@ -318,8 +213,7 @@ class SettingsController extends Controller
* *
* @return type view * @return type view
*/ */
public function postsmtp(SmtpRequest $request) public function postsmtp(SmtpRequest $request) {
{
$data = Smtp::where('id', '=', 1)->first(); $data = Smtp::where('id', '=', 1)->first();
$data->driver = $request->input('driver'); $data->driver = $request->input('driver');
$data->host = $request->input('host'); $data->host = $request->input('host');
@@ -330,47 +224,12 @@ class SettingsController extends Controller
$data->password = Crypt::encrypt($request->input('password')); $data->password = Crypt::encrypt($request->input('password'));
try { try {
$data->save(); $data->save();
return \Redirect::route('getsmtp')->with('success', 'success'); return \Redirect::route('getsmtp')->with('success', 'success');
} catch (Exception $e) { } catch (Exception $e) {
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]); return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
} }
} }
/**
* SMTP.
*
* @return type void
*/
public static function smtp()
{
$settings = Smtp::where('id', '=', '1')->first();
if ($settings->password) {
$password = Crypt::decrypt($settings->password);
Config::set('mail.driver', $settings->driver);
Config::set('mail.password', $password);
Config::set('mail.username', $settings->email);
Config::set('mail.encryption', $settings->encryption);
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->name]);
Config::set('mail.port', intval($settings->port));
Config::set('mail.host', $settings->host);
}
}
/**
* Settings.
*
* @param type Smtp $set
*
* @return type view\
*/
public function settings(Smtp $set)
{
$settings = $set->where('id', '1')->first();
return view('themes.default1.admin.settings', compact('settings'));
}
/** /**
* Post settings. * Post settings.
* *
@@ -379,8 +238,7 @@ class SettingsController extends Controller
* *
* @return type view * @return type view
*/ */
public function PostSettings(Settings $set, Request $request) public function PostSettings(Settings $set, Request $request) {
{
$settings = $set->where('id', '1')->first(); $settings = $set->where('id', '1')->first();
$pass = $request->input('password'); $pass = $request->input('password');
$password = Crypt::encrypt($pass); $password = Crypt::encrypt($pass);
@@ -393,7 +251,7 @@ class SettingsController extends Controller
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist/logo'; $destinationPath = 'dist/logo';
$fileName = rand(0000, 9999).'.'.$name; $fileName = rand(0000, 9999) . '.' . $name;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName; $settings->logo = $fileName;
$settings->save(); $settings->save();
@@ -407,60 +265,11 @@ class SettingsController extends Controller
} }
} }
/** public function Plugins() {
* version_check.
*
* @return type
*/
public function version_check()
{
$response_url = \URL::route('post-version-check');
echo "<form action='http://www.faveohelpdesk.com/billing/public/version' method='post' name='redirect'>";
echo "<input type='hidden' name='_token' value='csrf_token()'/>";
echo "<input type='hidden' name='title' value='Faveo helpdesk community'/>";
echo "<input type='hidden' name='response_url' value='".$response_url."' />";
echo '</form>';
echo "<script language='javascript'>document.redirect.submit();</script>";
}
/**
* post_version_check.
*
* @return type
*/
public function post_version_check(Request $request)
{
// dd($request);
$current_version = \Config::get('app.version');
$current_version = explode(' ', $current_version);
$current_version = $current_version[1];
$new_version = $request->value;
if ($current_version == $new_version) {
return redirect()->route('checkupdate')->with('info', ' No, new Updates');
} elseif ($current_version < $new_version) {
$version = Version_Check::where('id', '=', '1')->first();
$version->current_version = $current_version;
$version->new_version = $new_version;
$version->save();
return redirect()->route('checkupdate')->with('info', ' Version '.$new_version.' is Available');
} else {
return redirect()->route('checkupdate')->with('info', ' Error Checking Version');
}
}
public function getupdate()
{
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
}
public function Plugins()
{
return view('themes.default1.admin.helpdesk.settings.plugins'); return view('themes.default1.admin.helpdesk.settings.plugins');
} }
public function GetPlugin() public function GetPlugin() {
{
$plugins = $this->fetchConfig(); $plugins = $this->fetchConfig();
return \Datatable::collection(new Collection($plugins)) return \Datatable::collection(new Collection($plugins))
@@ -468,15 +277,15 @@ class SettingsController extends Controller
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
if (array_has($model, 'path')) { if (array_has($model, 'path')) {
if ($model['status'] == 0) { if ($model['status'] == 0) {
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Activate</a>'; $activate = '<a href=' . url('plugin/status/' . $model['path']) . '>Activate</a>';
$settings = ' '; $settings = ' ';
} else { } else {
$settings = '<a href='.url($model['settings']).'>Settings</a> | '; $settings = '<a href=' . url($model['settings']) . '>Settings</a> | ';
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Deactivate</a>'; $activate = '<a href=' . url('plugin/status/' . $model['path']) . '>Deactivate</a>';
} }
$delete = '<a href= id=delete'.$model['path'].' data-toggle=modal data-target=#del'.$model['path']."><span style='color:red'>Delete</span></a>" $delete = '<a href="#" id=delete' . $model['path'] . ' data-toggle=modal data-target=#del' . $model['path'] . "><span style='color:red'>Delete</span></a>"
."<div class='modal fade' id=del".$model['path']."> . "<div class='modal fade' id=del" . $model['path'] . ">
<div class='modal-dialog'> <div class='modal-dialog'>
<div class=modal-content> <div class=modal-content>
<div class=modal-header> <div class=modal-header>
@@ -485,8 +294,8 @@ class SettingsController extends Controller
<div class=modal-body> <div class=modal-body>
<p>Are you Sure ?</p> <p>Are you Sure ?</p>
<div class=modal-footer> <div class=modal-footer>
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>".\Lang::get('lang.close').'</button> <button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>" . \Lang::get('lang.close') . '</button>
<a href='.url('plugin/delete/'.$model['path'])."><button class='btn btn-danger'>Delete</button></a> <a href=' . url('plugin/delete/' . $model['path']) . "><button class='btn btn-danger'>Delete</button></a>
</div> </div>
@@ -494,12 +303,12 @@ class SettingsController extends Controller
</div> </div>
</div> </div>
</div>"; </div>";
$action = '<br><br>'.$delete.' | '.$settings.$activate; $action = '<br><br>' . $delete . ' | ' . $settings . $activate;
} else { } else {
$action = ''; $action = '';
} }
return ucfirst($model['name']).$action; return ucfirst($model['name']) . $action;
}) })
->addColumn('description', function ($model) { ->addColumn('description', function ($model) {
return ucfirst($model['description']); return ucfirst($model['description']);
@@ -508,7 +317,7 @@ class SettingsController extends Controller
return ucfirst($model['author']); return ucfirst($model['author']);
}) })
->addColumn('website', function ($model) { ->addColumn('website', function ($model) {
return '<a href='.$model['website'].' target=_blank>'.$model['website'].'</a>'; return '<a href=' . $model['website'] . ' target=_blank>' . $model['website'] . '</a>';
}) })
->addColumn('version', function ($model) { ->addColumn('version', function ($model) {
return $model['version']; return $model['version'];
@@ -521,9 +330,8 @@ class SettingsController extends Controller
* *
* @return type * @return type
*/ */
public function ReadPlugins() public function ReadPlugins() {
{ $dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins';
$plugins = array_diff(scandir($dir), ['.', '..']); $plugins = array_diff(scandir($dir), ['.', '..']);
return $plugins; return $plugins;
@@ -536,76 +344,85 @@ class SettingsController extends Controller
* *
* @return type * @return type
*/ */
public function PostPlugins(Request $request) public function PostPlugins(Request $request) {
{ $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']); try {
$plug = new Plugin(); if (!extension_loaded('zip')){
$file = $request->file('plugin'); throw new Exception('Please enable zip extension in your php');
//dd($file); }
$destination = app_path().DIRECTORY_SEPARATOR.'Plugins'; $plug = new Plugin();
$zipfile = $file->getRealPath(); $file = $request->file('plugin');
/* $destination = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
* get the file name and remove .zip $zipfile = $file->getRealPath();
*/ /*
$filename2 = $file->getClientOriginalName(); * get the file name and remove .zip
$filename2 = str_replace('.zip', '', $filename2); */
$filename1 = ucfirst($file->getClientOriginalName()); $filename2 = $file->getClientOriginalName();
$filename = str_replace('.zip', '', $filename1); $filename2 = str_replace('.zip', '', $filename2);
mkdir($destination.DIRECTORY_SEPARATOR.$filename); $filename1 = ucfirst($file->getClientOriginalName());
/* $filename = str_replace('.zip', '', $filename1);
* extract the zip file using zipper $dir_check = scandir($destination);
*/ if (in_array($filename, $dir_check)) {
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination.DIRECTORY_SEPARATOR.$filename); return redirect()->back()->with('fails', Lang::get('lang.plugin-exists'));
}
mkdir($destination . DIRECTORY_SEPARATOR . $filename);
/*
* extract the zip file using zipper
*/
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . DIRECTORY_SEPARATOR . $filename);
$file = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$filename; // Plugin file path $file = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $filename; // Plugin file path
if (file_exists($file)) { if (file_exists($file)) {
$seviceporvider = $file.DIRECTORY_SEPARATOR.'ServiceProvider.php'; $seviceporvider = $file . DIRECTORY_SEPARATOR . 'ServiceProvider.php';
$config = $file.DIRECTORY_SEPARATOR.'config.php'; $config = $file . DIRECTORY_SEPARATOR . 'config.php';
if (file_exists($seviceporvider) && file_exists($config)) { if (file_exists($seviceporvider) && file_exists($config)) {
/*
* move to faveo config
*/
$faveoconfig = config_path().DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$filename.'.php';
if ($faveoconfig) {
//copy($config, $faveoconfig);
/* /*
* write provider list in app.php line 128 * move to faveo config
*/ */
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $faveoconfig = config_path() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $filename . '.php';
chmod($app, 0644); if ($faveoconfig) {
$str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
$line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines));
$plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]);
return redirect()->back()->with('success', 'Installed SuccessFully'); //copy($config, $faveoconfig);
/*
* write provider list in app.php line 128
*/
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
chmod($app, 0644);
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',";
$line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines));
$plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]);
return redirect()->back()->with('success', Lang::get('lang.plugin-installed'));
} else {
/*
* delete if the plugin hasn't config.php and ServiceProvider.php
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', Lang::get('no-plugin-file') . $file);
}
} else { } else {
/* /*
* delete if the plugin hasn't config.php and ServiceProvider.php * delete if the plugin hasn't config.php and ServiceProvider.php
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no '.$file); return redirect()->back()->with('fails', Lang::get('plugin-config-missing') . $file);
} }
} else { } else {
/* /*
* delete if the plugin hasn't config.php and ServiceProvider.php * delete if the plugin Name is not equal to the folder name
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> '.$file); return redirect()->back()->with('fails', '<b>' . Lang::get('lang.plugin-path-missing') . '</b> ' . $file);
} }
} else { } catch (Exception $ex) {
/* return redirect()->back()->with('fails', $ex->getMessage());
* delete if the plugin Name is not equal to the folder name
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> '.$file);
} }
} }
@@ -616,8 +433,7 @@ class SettingsController extends Controller
* *
* @return bool * @return bool
*/ */
public function deleteDirectory($dir) public function deleteDirectory($dir) {
{
if (!file_exists($dir)) { if (!file_exists($dir)) {
return true; return true;
} }
@@ -628,8 +444,8 @@ class SettingsController extends Controller
if ($item == '.' || $item == '..') { if ($item == '.' || $item == '..') {
continue; continue;
} }
chmod($dir.DIRECTORY_SEPARATOR.$item, 0777); chmod($dir . DIRECTORY_SEPARATOR . $item, 0777);
if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) { if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
return false; return false;
} }
} }
@@ -638,9 +454,8 @@ class SettingsController extends Controller
return rmdir($dir); return rmdir($dir);
} }
public function ReadConfigs() public function ReadConfigs() {
{ $dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR;
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR;
$directories = scandir($dir); $directories = scandir($dir);
$files = []; $files = [];
foreach ($directories as $key => $file) { foreach ($directories as $key => $file) {
@@ -648,7 +463,7 @@ class SettingsController extends Controller
continue; continue;
} }
if (is_dir($dir.DIRECTORY_SEPARATOR.$file)) { if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$files[$key] = $file; $files[$key] = $file;
} }
} }
@@ -657,7 +472,7 @@ class SettingsController extends Controller
$plugins = []; $plugins = [];
if (count($files) > 0) { if (count($files) > 0) {
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
$plugin = $dir.$file; $plugin = $dir . $file;
$plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']); $plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
$plugins[$key]['file'] = $plugin; $plugins[$key]['file'] = $plugin;
} }
@@ -667,7 +482,7 @@ class SettingsController extends Controller
if ($dh = opendir($dir)) { if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {
if ($file == 'config.php') { if ($file == 'config.php') {
$config[] = $dir.DIRECTORY_SEPARATOR.$file; $config[] = $dir . DIRECTORY_SEPARATOR . $file;
} }
} }
closedir($dh); closedir($dh);
@@ -680,8 +495,7 @@ class SettingsController extends Controller
} }
} }
public function fetchConfig() public function fetchConfig() {
{
$configs = $this->ReadConfigs(); $configs = $this->ReadConfigs();
//dd($configs); //dd($configs);
$plugs = new Plugin(); $plugs = new Plugin();
@@ -717,15 +531,14 @@ class SettingsController extends Controller
return $attributes; return $attributes;
} }
public function DeletePlugin($slug) public function DeletePlugin($slug) {
{ $dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $slug;
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$slug;
$this->deleteDirectory($dir); $this->deleteDirectory($dir);
/* /*
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',"; $str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, '//', $file_contents); $file_contents = str_replace($str, '//', $file_contents);
file_put_contents($path_to_file, $file_contents); file_put_contents($path_to_file, $file_contents);
@@ -738,13 +551,12 @@ class SettingsController extends Controller
return redirect()->back()->with('success', 'Deleted Successfully'); return redirect()->back()->with('success', 'Deleted Successfully');
} }
public function StatusPlugin($slug) public function StatusPlugin($slug) {
{
$plugs = new Plugin(); $plugs = new Plugin();
$plug = $plugs->where('name', $slug)->first(); $plug = $plugs->where('name', $slug)->first();
if (!$plug) { if (!$plug) {
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
@@ -757,8 +569,8 @@ class SettingsController extends Controller
if ($status == 0) { if ($status == 0) {
$plug->status = 1; $plug->status = 1;
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
@@ -769,8 +581,8 @@ class SettingsController extends Controller
/* /*
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, '//', $file_contents); $file_contents = str_replace($str, '//', $file_contents);

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\Http\Controllers\Controller;
class HomeController extends Controller class HomeController extends Controller
{ {
@@ -38,13 +39,6 @@ class HomeController extends Controller
return view('themes/default1/admin/dashboard'); return view('themes/default1/admin/dashboard');
} }
public function getsmtp()
{
$smtp = \App\Model\helpdesk\Email\Smtp::where('id', '=', '1')->first();
return $smtp->host;
}
public function getdata() public function getdata()
{ {
return \View::make('emails/notifications/agent'); return \View::make('emails/notifications/agent');

View File

@@ -9,69 +9,73 @@ use Artisan;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class UpgradeController extends Controller class UpgradeController extends Controller {
{
public $dir; public $dir;
public function __construct() public function __construct() {
{
$dir = base_path(); $dir = base_path();
$this->dir = $dir; $this->dir = $dir;
} }
public function getLatestVersion() public function getLatestVersion() {
{ try {
$name = \Config::get('app.name'); $name = \Config::get('app.name');
//serial key should be encrypted data //dd($name);
$serial_key = Utility::encryptByFaveoPublicKey('O5Y647RJF8QHLDOE'); //serial key should be encrypted data
//order number should be encrypted data $serial_key = '64JAHF9WVJA4GCUZ';
$order_number = Utility::encryptByFaveoPublicKey('23540755'); //order number should be encrypted data
$url = url('/'); $order_number = '44596328';
//dd($url); $url = env('APP_URL');
$post_data = [ $data = [
'serial_key' => $serial_key, 'serial_key' => $serial_key,
'order_number' => $order_number, 'order_number' => $order_number,
'name' => $name, 'name' => $name,
'version' => Utility::getFileVersion(), 'version' => Utility::getFileVersion(),
'request_type' => 'check_update', 'request_type' => 'check_update',
'url' => $url, 'url' => $url,
]; ];
$url = 'http://www.faveohelpdesk.com/billing/verification'; $data = Utility::encryptByFaveoPublicKey(json_encode($data));
if (str_contains($url, ' ')) { //dd($data);
$url = str_replace(' ', '%20', $url); $post_data = [
} 'data' => $data
$curl = $this->postCurl($url, $post_data); ];
//dd($curl); $url = 'http://faveohelpdesk.com/billing/public/verification';
if (is_array($curl)) { if (str_contains($url, ' ')) {
if (array_key_exists('status', $curl)) { $url = str_replace(' ', '%20', $url);
if ($curl['status'] == 'success') { }
if (array_key_exists('version', $curl)) { $curl = $this->postCurl($url, $post_data);
return $curl['version']; if (is_array($curl)) {
if (array_key_exists('status', $curl)) {
if ($curl['status'] == 'success') {
if (array_key_exists('version', $curl)) {
return $curl['version'];
}
} }
} }
} }
} catch (\Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
public function downloadLatestCode() public function downloadLatestCode() {
{
$name = \Config::get('app.name'); $name = \Config::get('app.name');
$url = 'http://www.faveohelpdesk.com/billing/download-url'; $durl = 'http://www.faveohelpdesk.com/billing/public/download-url';
if (str_contains($url, ' ')) { if (str_contains($durl, ' ')) {
$url = str_replace(' ', '%20', $url); $durl = str_replace(' ', '%20', $durl);
} }
$data = [ $data = [
'name' => $name, 'name' => $name,
]; ];
$download = $this->postCurl($url, $data); $download = $this->postDownloadCurl($durl, $data);
$url = $download['zipball_url']; $download_url = $download['zipball_url'];
return $url; return $download_url;
} }
public function saveLatestCodeAtTemp($download_url) public function saveLatestCodeAtTemp($download_url) {
{
echo '<p>Downloading New Update</p>'; echo '<p>Downloading New Update</p>';
$context = stream_context_create( $context = stream_context_create(
[ [
@@ -83,10 +87,10 @@ class UpgradeController extends Controller
$newUpdate = file_get_contents($download_url, false, $context); $newUpdate = file_get_contents($download_url, false, $context);
if (!is_dir("$this->dir/UPDATES/")) { if (!is_dir("$this->dir/UPDATES/")) {
\File::makeDirectory($this->dir.'/UPDATES/', 0777); \File::makeDirectory($this->dir . '/UPDATES/', 0777);
} }
$dlHandler = fopen($this->dir.'/UPDATES/'.'/faveo-helpdesk-master.zip', 'w'); $dlHandler = fopen($this->dir . '/UPDATES/' . '/faveo-helpdesk-master.zip', 'w');
if (!fwrite($dlHandler, $newUpdate)) { if (!fwrite($dlHandler, $newUpdate)) {
echo '<p>Could not save new update. Operation aborted.</p>'; echo '<p>Could not save new update. Operation aborted.</p>';
exit(); exit();
@@ -95,85 +99,108 @@ class UpgradeController extends Controller
echo '<p>Update Downloaded And Saved</p>'; echo '<p>Update Downloaded And Saved</p>';
} }
public function doUpdate() public function doUpdate() {
{ try {
Artisan::call('down'); $memory_limit = ini_get('memory_limit');
$update = $this->dir.'/UPDATES'; if ($memory_limit < 256) {
//Open The File And Do Stuff echo '<ul class=list-unstyled>';
$zipHandle = zip_open($update.'/faveo-helpdesk-master.zip'); 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>";
//dd($update . '/faveo-' . $aV . '.zip'); echo '</ul>';
return 0;
echo '<ul class=list-unstyled>';
while ($aF = zip_read($zipHandle)) {
$thisFileName = zip_entry_name($aF);
$thisFileDir = dirname($thisFileName);
//Continue if its not a file
if (substr($thisFileName, -1, 1) == '/') {
continue;
} }
if (!extension_loaded('zip')) {
echo '<ul class=list-unstyled>';
//Make the directory if we need to... echo "<li style='color:red;'>Sorry we can not process your request because you don't have ZIP extension contact your system admin</li>";
if (!is_dir($update.'/'.$thisFileDir.'/')) { echo '</ul>';
\File::makeDirectory($update.'/'.$thisFileDir, 0775, true, true); return 0;
// mkdir($update.'/'. $thisFileDir, 0775);
echo '<li style="color:white;">Created Directory '.$thisFileDir.'</li>';
} }
//Artisan::call('down');
$update = $this->dir . '/UPDATES';
//Open The File And Do Stuff
$zipHandle = zip_open($update . '/faveo-helpdesk-master.zip');
//dd($update . '/faveo-' . $aV . '.zip');
//Overwrite the file echo '<ul class=list-unstyled>';
if (!is_dir($update.'/'.$thisFileName)) { while ($aF = zip_read($zipHandle)) {
echo '<li style="color:white;">'.$thisFileName.'...........'; $thisFileName = zip_entry_name($aF);
$contents = zip_entry_read($aF, zip_entry_filesize($aF)); $thisFileDir = dirname($thisFileName);
$contents = str_replace("\r\n", "\n", $contents);
$updateThis = '';
//If we need to run commands, then do it. //Continue if its not a file
if ($thisFileName == $thisFileDir.'/.env') { if (substr($thisFileName, -1, 1) == '/') {
if (is_file($update.'/'.$thisFileDir.'/.env')) { continue;
unlink($update.'/'.$thisFileDir.'/.env'); }
unlink($update.'/'.$thisFileDir.'/config/database.php');
//Make the directory if we need to...
if (!is_dir($update . '/' . $thisFileDir . '/')) {
\File::makeDirectory($update . '/' . $thisFileDir, 0775, true, true);
// mkdir($update.'/'. $thisFileDir, 0775);
echo '<li style="color:white;">Created Directory ' . $thisFileDir . '</li>';
}
//Overwrite the file
if (!is_dir($update . '/' . $thisFileName)) {
echo '<li style="color:white;">' . $thisFileName . '...........';
$contents = zip_entry_read($aF, zip_entry_filesize($aF));
$contents = str_replace("\r\n", "\n", $contents);
$updateThis = '';
//If we need to run commands, then do it.
if ($thisFileName == $thisFileDir . '/.env') {
if (is_file($update . '/' . $thisFileDir . '/.env')) {
unlink($update . '/' . $thisFileDir . '/.env');
unlink($update . '/' . $thisFileDir . '/config/database.php');
}
echo' EXECUTED</li>';
} else {
$updateThis = fopen($update . '/' . $thisFileName, 'w');
fwrite($updateThis, $contents);
fclose($updateThis);
unset($contents);
echo' UPDATED</li>';
} }
echo' EXECUTED</li>';
} else {
$updateThis = fopen($update.'/'.$thisFileName, 'w');
fwrite($updateThis, $contents);
fclose($updateThis);
unset($contents);
echo' UPDATED</li>';
} }
} }
echo '</ul>';
//Artisan::call('migrate', ['--force' => true]);
return true;
} catch (Exception $ex) {
echo '<ul class=list-unstyled>';
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>";
echo '</ul>';
} }
echo '</ul>';
Artisan::call('up');
return true;
} }
public function copyToActualDirectory($latest_version) public function copyToActualDirectory($latest_version) {
{ try {
$directory = "$this->dir/UPDATES"; echo '<ul class=list-unstyled>';
$destination = $this->dir; $directory = "$this->dir/UPDATES";
$destination = $this->dir;
// $destination = "/Applications/AMPPS/www/test/new"; // $destination = "/Applications/AMPPS/www/test/new";
$directories = \File::directories($directory); $directories = \File::directories($directory);
// echo "current directory => $directory <br>"; // echo "current directory => $directory <br>";
// echo "Destination Directory => $destination <br>"; // echo "Destination Directory => $destination <br>";
foreach ($directories as $source) { foreach ($directories as $source) {
$success = \File::copyDirectory($source, $destination); $success = \File::copyDirectory($source, $destination);
echo '<p class="success">&raquo; </p>'; echo '<li class="success">&raquo; </li>';
}
\File::deleteDirectory($directory);
$this->deleteBarNotification('new-version');
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 '</ul>';
} }
exit();
\File::deleteDirectory($directory);
$this->deleteBarNotification('new-version');
echo '<p class="success">&raquo; Faveo Updated to v'.Utility::getFileVersion().'</p>';
} }
public function deleteBarNotification($key) public function deleteBarNotification($key) {
{
try { try {
$noti = new BarNotification(); $noti = new BarNotification();
$notifications = $noti->where('key', $key)->get(); $notifications = $noti->where('key', $key)->get();
@@ -185,45 +212,43 @@ class UpgradeController extends Controller
} }
} }
public function fileUpdate() public function fileUpdate() {
{
try { try {
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) { $latest_version = $this->getLatestVersion();
if (Utility::getFileVersion() < $latest_version) {
$url = url('file-upgrade'); $url = url('file-upgrade');
//$string = "Your Database is outdated please upgrade <a href=$url>Now !</a>";
return view('themes.default1.update.file', compact('url')); return view('themes.default1.update.file', compact('url'));
} else {
return redirect()->back();
} }
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
public function fileUpgrading(Request $request) public function fileUpgrading(Request $request) {
{
try { try {
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) { //
$latest_version = $this->getLatestVersion(); $latest_version = $this->getLatestVersion();
//dd($latest_version);
$current_version = Utility::getFileVersion();
if ($latest_version != '') {
$_this = new self();
return view('themes.default1.update.test', compact('latest_version', 'current_version', 'request')); $current_version = Utility::getFileVersion();
} else { if ($latest_version != '') {
return redirect()->back()->with('fails', 'Could not find latest realeases from repository.'); if (Utility::getFileVersion() < $latest_version) {
return view('themes.default1.update.update', compact('latest_version', 'current_version', 'request'));
} }
} else {
return redirect()->back();
} }
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
// else {
// return redirect()->back();
// }
} catch (Exception $ex) { } catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
public function testScroll() public function testScroll() {
{
$ex = 1000; $ex = 1000;
echo '<ul style=list-unstyled>'; echo '<ul style=list-unstyled>';
for ($i = 0; $i < $ex; $i++) { for ($i = 0; $i < $ex; $i++) {
@@ -232,8 +257,7 @@ class UpgradeController extends Controller
echo '</ul>'; echo '</ul>';
} }
public function fileUpgrading1(Request $request) public function fileUpgrading1(Request $request) {
{
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) { if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
$latest_version = $this->getLatestVersion(); $latest_version = $this->getLatestVersion();
// dd($latest_version); // dd($latest_version);
@@ -243,7 +267,7 @@ class UpgradeController extends Controller
echo "<p>CURRENT VERSION: $current_version</p>"; echo "<p>CURRENT VERSION: $current_version</p>";
echo '<p>Reading Current Releases List</p>'; echo '<p>Reading Current Releases List</p>';
if ($latest_version > $current_version) { if ($latest_version > $current_version) {
echo '<p>New Update Found: v'.$latest_version.'</p>'; echo '<p>New Update Found: v' . $latest_version . '</p>';
$found = true; $found = true;
if (!is_file("$this->dir/UPDATES/faveo-helpdesk-master.zip")) { if (!is_file("$this->dir/UPDATES/faveo-helpdesk-master.zip")) {
if ($request->get('dodownload') == true) { if ($request->get('dodownload') == true) {
@@ -254,7 +278,7 @@ class UpgradeController extends Controller
echo '<p>Error in you network connection.</p>'; echo '<p>Error in you network connection.</p>';
} }
} else { } else {
echo '<p>Latest code found. <a href='.url('file-upgrade?dodownload=true').'>&raquo; Download Now?</a></p>'; echo '<p>Latest code found. <a href=' . url('file-upgrade?dodownload=true') . '>&raquo; Download Now?</a></p>';
exit(); exit();
} }
} else { } else {
@@ -263,7 +287,7 @@ class UpgradeController extends Controller
if ($request->get('doUpdate') == true) { if ($request->get('doUpdate') == true) {
$updated = $this->doUpdate(); $updated = $this->doUpdate();
} else { } else {
echo '<p>Update ready. <a href='.url('file-upgrade?doUpdate=true').'>&raquo; Install Now?</a></p>'; echo '<p>Update ready. <a href=' . url('file-upgrade?doUpdate=true') . '>&raquo; Install Now?</a></p>';
exit(); exit();
} }
@@ -283,40 +307,73 @@ class UpgradeController extends Controller
} }
} }
public function getCurl($url) public function getCurl($url) {
{ try {
$ch = curl_init(); $curl = Utility::_isCurl();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if (!$curl) {
//curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); throw new Exception("Please enable your curl function to check latest update");
curl_setopt($ch, CURLOPT_URL, $url); }
if (curl_exec($ch) === false) { $ch = curl_init();
echo 'Curl error: '.curl_error($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
} curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch); if (curl_exec($ch) === false) {
dd($data); echo 'Curl error: ' . curl_error($ch);
curl_close($ch); }
$data = curl_exec($ch);
curl_close($ch);
return $data; return $data;
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
} }
public function postCurl($url, $data) public function postDownloadCurl($url, $data) {
{ try {
$ch = curl_init(); $curl = Utility::_isCurl();
curl_setopt($ch, CURLOPT_POST, 1); if (!$curl) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); throw new Exception("Please enable your curl function to check latest update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); }
curl_setopt($ch, CURLOPT_URL, $url); $ch = curl_init();
if (curl_exec($ch) === false) { curl_setopt($ch, CURLOPT_POST, 1);
echo 'Curl error: '.curl_error($ch); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
if (curl_exec($ch) === false) {
echo 'Curl error: ' . curl_error($ch);
}
$data = curl_exec($ch);
curl_close($ch);
return json_decode($data, true);
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
} }
$data = curl_exec($ch);
curl_close($ch);
return json_decode($data, true);
} }
public function databaseUpdate() public function postCurl($url, $data) {
{ try {
$curl = Utility::_isCurl();
if (!$curl) {
throw new Exception("Please enable your curl function to check latest update");
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
if (curl_exec($ch) === false) {
echo 'Curl error: ' . curl_error($ch);
}
$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() {
try { try {
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) { if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
$url = url('database-upgrade'); $url = url('database-upgrade');
@@ -330,8 +387,7 @@ class UpgradeController extends Controller
} }
} }
public function databaseUpgrade() public function databaseUpgrade() {
{
try { try {
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) { if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
@@ -344,4 +400,5 @@ class UpgradeController extends Controller
return redirect()->back()->with('fails', $ex->getMessage()); return redirect()->back()->with('fails', $ex->getMessage());
} }
} }
} }

View File

@@ -7,10 +7,9 @@ use Config;
use Exception; use Exception;
use Schema; use Schema;
class LibraryController extends Controller class LibraryController extends Controller {
{
public static function getFileVersion() public static function getFileVersion() {
{
try { try {
$app = Config::get('app.version'); $app = Config::get('app.version');
if ($app) { if ($app) {
@@ -23,8 +22,7 @@ class LibraryController extends Controller
} }
} }
public static function getDatabaseVersion() public static function getDatabaseVersion() {
{
try { try {
$database = self::isDatabaseSetup(); $database = self::isDatabaseSetup();
if ($database == true) { if ($database == true) {
@@ -41,8 +39,7 @@ class LibraryController extends Controller
} }
} }
public static function isDatabaseSetup() public static function isDatabaseSetup() {
{
try { try {
if (Schema::hasTable('settings_system')) { if (Schema::hasTable('settings_system')) {
return true; return true;
@@ -52,78 +49,47 @@ class LibraryController extends Controller
} }
} }
public static function encryptByFaveoPublicKey($plaintext) public static function encryptByFaveoPublicKey($data) {
{
try { try {
// Compress the data to be sent $path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key';
$plaintext = gzcompress($plaintext);
// Get the public Key of the recipient
$path = storage_path('app'.DIRECTORY_SEPARATOR.'faveo-public.key');
$key_content = file_get_contents($path);
//dd($path); //dd($path);
$publicKey = openssl_pkey_get_public($key_content);
//dd($publicKey);
$a_key = openssl_pkey_get_details($publicKey);
// Encrypt the data in small chunks and then combine and send it.
$chunkSize = ceil($a_key['bits'] / 8) - 11;
$output = '';
while ($plaintext) {
$chunk = substr($plaintext, 0, $chunkSize);
$plaintext = substr($plaintext, $chunkSize);
$encrypted = '';
if (!openssl_public_encrypt($chunk, $encrypted, $publicKey)) {
throw new Exception('Failed to encrypt data');
}
$output .= $encrypted;
}
openssl_free_key($publicKey);
// This is the final encrypted data to be sent to the recipient
$encrypted = $output;
return $encrypted;
} catch (Exception $ex) {
dd($ex);
}
}
public static function decryptByFaveoPrivateKey($encrypted)
{
try {
//$encrypted = p¥Ùn¿olÓ¥9)OÞݸÔvh§=Ìtt1rkC‰É§%YœfÐS\BâkHW€mùÌØg¹+VŠ¥²?áÙ{/<¶¡£e¡ˆr°(V)Öíàr„Ž]K9¤ÿÖ¡Åmž”üÈoò״µºŽ06¼e €rœ['4çhH¾ö:¨œS„œ¦,|¤ÇqÂrÈŸd+ml‡ uötφûóŽ&áyÙ(ÆŒÁ$¥±Zj*îàÒöLˆD†aɐö_§è¶°·V„Þú]%ÅR*B=žéršæñ*i+፭±èç|c¹Ñߟ­F$;
// Get the private Key
$path = storage_path('app'.DIRECTORY_SEPARATOR.'faveo-private.key');
$key_content = file_get_contents($path); $key_content = file_get_contents($path);
if (!$privateKey = openssl_pkey_get_private($key_content)) { $public_key = openssl_get_publickey($key_content);
die('Private Key failed');
}
$a_key = openssl_pkey_get_details($privateKey);
// Decrypt the data in the small chunks $encrypted = $e = NULL;
$chunkSize = ceil($a_key['bits'] / 8); openssl_seal($data, $encrypted, $e, array($public_key));
$output = '';
while ($encrypted) { $sealed_data = base64_encode($encrypted);
$chunk = substr($encrypted, 0, $chunkSize); $envelope = base64_encode($e[0]);
$encrypted = substr($encrypted, $chunkSize);
$decrypted = '';
if (!openssl_private_decrypt($chunk, $decrypted, $privateKey)) {
die('Failed to decrypt data');
}
$output .= $decrypted;
}
openssl_free_key($privateKey);
// Uncompress the unencrypted data. $result = ['seal' => $sealed_data, 'envelope' => $envelope];
$output = gzuncompress($output); return json_encode($result);
echo '<br /><br /> Unencrypted Data: '.$output;
} catch (Exception $ex) { } catch (Exception $ex) {
dd($ex); throw new Exception($ex->getMessage());
} }
} }
public static function decryptByFaveoPrivateKey($encrypted) {
try {
$encrypted = json_decode($encrypted);
$sealed_data = $encrypted->seal;
$envelope = $encrypted->envelope;
$input = base64_decode($sealed_data);
$einput = base64_decode($envelope);
$path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key');
$key_content = file_get_contents($path);
$private_key = openssl_get_privatekey($key_content);
$plaintext = NULL;
openssl_open($input, $plaintext, $einput, $private_key);
return $plaintext;
} catch (Exception $ex) {
// dd($ex);
}
}
public static function _isCurl() {
return function_exists('curl_version');
}
} }

View File

@@ -34,7 +34,6 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class,
//\App\Http\Middleware\VerifyCsrfToken::class, //\App\Http\Middleware\VerifyCsrfToken::class,
\App\Http\Middleware\LanguageMiddleware::class, \App\Http\Middleware\LanguageMiddleware::class,
], ],
'api' => [ 'api' => [
'throttle:60,1', 'throttle:60,1',

View File

@@ -24,12 +24,12 @@ class CheckUpdate
if ($check == true) { if ($check == true) {
//$this->notificationBar(); //$this->notificationBar();
$this->checkNewUpdate(); $this->checkNewUpdate();
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) { // if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
return redirect('database-update'); // return redirect('database-update');
} // }
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) { // if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
return redirect('file-update'); // return redirect('file-update');
} // }
} }
return $next($request); return $next($request);
@@ -56,7 +56,7 @@ class CheckUpdate
$not = $notify->get(); $not = $notify->get();
if ($not->count() > 0) { if ($not->count() > 0) {
$now = \Carbon\Carbon::now(); $now = \Carbon\Carbon::now();
$yesterday = \Carbon\Carbon::now(-24); $yesterday = \Carbon\Carbon::yesterday();
$notifications = $notify->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key'); $notifications = $notify->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key');
$todelete = $notify->where('created_at', '<', $yesterday)->get(); $todelete = $notify->where('created_at', '<', $yesterday)->get();
if ($todelete->count() > 0) { if ($todelete->count() > 0) {
@@ -113,7 +113,7 @@ class CheckUpdate
if ($n) { if ($n) {
$now = \Carbon\Carbon::now(); $now = \Carbon\Carbon::now();
$yesterday = \Carbon\Carbon::now(-24); $yesterday = \Carbon\Carbon::yesterday();
$notifications = $notify->where('key', 'new-version')->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key'); $notifications = $notify->where('key', 'new-version')->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key');
if ($notifications->count() > 0) { if ($notifications->count() > 0) {
return false; return false;

View File

@@ -29,10 +29,10 @@ class AgentUpdate extends Request
public function rules() public function rules()
{ {
return [ return [
'user_name' => 'required|max:30', 'user_name' => 'required|max:30|min:3|unique:users,user_name,'.$this->segment(2),
'first_name' => 'required|max:30', 'first_name' => 'required|max:30',
'last_name' => 'required|max:30', 'last_name' => 'required|max:30',
'email' => 'required|email', 'email' => 'required|email|unique:users,email,'.$this->segment(2),
'active' => 'required', 'active' => 'required',
'role' => 'required', 'role' => 'required',
'group' => 'required', 'group' => 'required',

View File

@@ -31,7 +31,7 @@ class CreateTicketRequest extends Request
return [ return [
'email' => 'required|email|max:60', 'email' => 'required|email|max:60',
'fullname' => 'required|min:3|max:40', 'user_name' => 'required|min:3|max:40',
'helptopic' => 'required', 'helptopic' => 'required',
// 'dept' => 'required', // 'dept' => 'required',
'sla' => 'required', 'sla' => 'required',

View File

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

View File

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

View File

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

View File

@@ -23,9 +23,9 @@ class CategoryRequest extends Request
*/ */
public function rules() public function rules()
{ {
$id = $this->segment(2);
return [ return [
'name' => 'required|max:250', 'name' => 'required|max:250|unique:kb_category,name,'.$id,
'slug' => 'required|unique:kb_category',
'description' => 'required', 'description' => 'required',
]; ];
} }

View File

@@ -1,32 +0,0 @@
<?php
namespace App\Http\Requests\kb;
use App\Http\Requests\Request;
class CategoryUpdate extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|max:250',
'slug' => 'required',
'description' => 'required',
];
}
}

View File

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

View File

@@ -1,32 +0,0 @@
<?php
namespace App\Http\Requests\kb;
use App\Http\Requests\Request;
class PageUpdate extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'slug' => 'required',
//'description' => 'required',
];
}
}

File diff suppressed because it is too large Load Diff

40
app/Jobs/SendEmail.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
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;
class SendEmail extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
protected $from;
protected $to;
protected $message;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($from, $to, $message)
{
$this->from = $from;
$this->to = $to;
$this->message = $message;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(PhpMailController $PhpMailController)
{
$PhpMailController->sendEmail($this->from, $this->to, $this->message);
}
}

View File

@@ -1,12 +0,0 @@
<?php
namespace App\Model\helpdesk\Email;
use App\BaseModel;
class Smtp extends BaseModel
{
public $timestamps = false;
protected $table = 'send_mail';
protected $fillable = ['driver', 'port', 'host', 'encryption', 'name', 'email', 'password'];
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Model\helpdesk\Form;
use Illuminate\Database\Eloquent\Model;
class FieldValue extends Model
{
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; use App\BaseModel;
class Fields extends BaseModel class Fields extends BaseModel {
{
protected $table = 'custom_form_fields'; protected $table = 'custom_form_fields';
/** /**
@@ -14,4 +14,29 @@ class Fields extends BaseModel
* @var array * @var array
*/ */
protected $fillable = ['forms_id', 'label', 'name', 'type', 'value', 'required']; protected $fillable = ['forms_id', 'label', 'name', 'type', 'value', 'required'];
public function valueRelation() {
$related = "App\Model\helpdesk\Form\FieldValue";
return $this->hasMany($related, 'field_id');
}
public function values() {
$value = $this->valueRelation();
return $value;
}
public function deleteValues() {
$values = $this->values()->get();
if ($values->count() > 0) {
foreach ($values as $value) {
$value->delete();
}
}
}
public function delete() {
parent::delete();
}
} }

View File

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

View File

@@ -8,7 +8,7 @@ class Ticket_Thread extends BaseModel
{ {
protected $table = 'ticket_thread'; protected $table = 'ticket_thread';
protected $fillable = [ protected $fillable = [
'id', 'pid', 'ticket_id', 'staff_id', 'user_id', 'thread_type', 'poster', 'source', 'is_internal', 'title', 'body', 'format', 'ip_address', 'created_at', 'updated_at', 'id', 'ticket_id', 'staff_id', 'user_id', 'thread_type', 'poster', 'source', 'is_internal', 'title', 'body', 'format', 'ip_address', 'created_at', 'updated_at',
]; ];
public function attach() public function attach()

View File

@@ -15,7 +15,7 @@ class Tickets extends BaseModel
// } // }
public function thread() public function thread()
{ {
return $this->hasMany('App\Model\helpdesk\Ticket\Ticket_thread', 'ticket_id'); return $this->hasMany('App\Model\helpdesk\Ticket\Ticket_Thread', 'ticket_id');
} }
public function collaborator() public function collaborator()

View File

@@ -6,6 +6,6 @@ use App\BaseModel;
class Limit_Login extends BaseModel class Limit_Login extends BaseModel
{ {
protected $table = 'limit_login'; protected $table = 'login_attempts';
protected $fillable = ['email', 'ip_address', 'duration', 'attempt_time', 'created_at', 'updated_at']; protected $fillable = ['User', 'IP', 'Attempts', 'LastLogin', 'created_at', 'updated_at'];
} }

View File

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

View File

@@ -18,7 +18,10 @@ class ConfigServiceProvider extends ServiceProvider
public function register() public function register()
{ {
config([ config([
'lfm.images_url' => url('photos').'/', 'lfm.images_url' => url('uploads').'/',
'lfm.images_dir' => 'public/uploads/',
'lfm.files_url' => url('files').'/',
'lfm.files_dir' => '/files/',
]); ]);
} }
} }

View File

@@ -28,7 +28,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic', protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic',
'phone_number', 'company', 'agent_sign', 'account_type', 'account_status', 'phone_number', 'company', 'agent_sign', 'account_type', 'account_status',
'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access', 'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access',
'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code', ]; 'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code','fcm_token' ];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
@@ -43,7 +43,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
if (!$value) { if (!$value) {
return \Gravatar::src($this->attributes['email']); return \Gravatar::src($this->attributes['email']);
} else { } else {
return asset('lb-faveo/media/profilepic/'.$value); return asset('uploads/profilepic/'.$value);
} }
} }
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
ini_set('xdebug.max_nesting_level', 500);
define('LARAVEL_START', microtime(true)); define('LARAVEL_START', microtime(true));
/* /*

View File

@@ -21,12 +21,14 @@
"chumper/datatable": "dev-develop", "chumper/datatable": "dev-develop",
"chumper/zipper": "0.6.x", "chumper/zipper": "0.6.x",
"phpmailer/phpmailer": "^5.2", "phpmailer/phpmailer": "^5.2",
"bestmomo/filemanager": "1.1.*",
"unisharp/laravel-filemanager": "^1.1", "unisharp/laravel-filemanager": "^1.1",
"tymon/jwt-auth": "0.5.*", "tymon/jwt-auth": "0.5.*",
"php": ">=5.5.9", "php": ">=5.5.9",
"davejamesmiller/laravel-breadcrumbs": "^3.0", "davejamesmiller/laravel-breadcrumbs": "^3.0",
"torann/geoip": "0.2.*@dev" "torann/geoip": "0.2.*@dev",
"davibennun/laravel-push-notification": "dev-laravel5",
"brozot/laravel-fcm": "^1.0",
"barryvdh/laravel-debugbar": "^2.2"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0", "phpunit/phpunit": "~4.0",

1016
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,8 @@ return [
| This tells about aplication current version. | This tells about aplication current version.
| |
*/ */
'version' => 'Community 1.0.7.8', 'version' => 'Community 1.0.7.9',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Name | Application Name
@@ -43,6 +44,7 @@ return [
| |
*/ */
'name' => 'Faveo helpdesk community', 'name' => 'Faveo helpdesk community',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application URL | Application URL
@@ -135,12 +137,16 @@ return [
'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider',
'DaveJamesMiller\Breadcrumbs\ServiceProvider', 'DaveJamesMiller\Breadcrumbs\ServiceProvider',
/*
*/
/* /*
* Laravel Framework Service Providers... * Laravel Framework Service Providers...
*/ */
//
'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Bus\BusServiceProvider', 'Illuminate\Bus\BusServiceProvider',
'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Cache\CacheServiceProvider',
@@ -151,7 +157,8 @@ return [
'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider',
'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Mail\MailServiceProvider', Illuminate\Mail\MailServiceProvider::class,
'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider',
'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Queue\QueueServiceProvider',
@@ -175,11 +182,13 @@ return [
'Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider', 'Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider',
'Chumper\Datatable\DatatableServiceProvider', 'Chumper\Datatable\DatatableServiceProvider',
'Chumper\Zipper\ZipperServiceProvider', 'Chumper\Zipper\ZipperServiceProvider',
'Bestmomo\Filemanager\FilemanagerServiceProvider', Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
'Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider', Intervention\Image\ImageServiceProvider::class,
'Intervention\Image\ImageServiceProvider',
'Tymon\JWTAuth\Providers\JWTAuthServiceProvider', 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider',
'Torann\GeoIP\GeoIPServiceProvider', 'Torann\GeoIP\GeoIPServiceProvider',
LaravelFCM\FCMServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -234,12 +243,14 @@ return [
'SMTPS' => 'App\Http\Controllers\HomeController', 'SMTPS' => 'App\Http\Controllers\HomeController',
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade', 'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
'Zipper' => 'Chumper\Zipper\Zipper', 'Zipper' => 'Chumper\Zipper\Zipper',
'Image' => 'Intervention\Image\Facades\Image',
'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth', 'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory', 'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory',
'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade', 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',
'GeoIP' => 'Torann\GeoIP\GeoIPFacade', 'GeoIP' => 'Torann\GeoIP\GeoIPFacade',
'Image' => Intervention\Image\Facades\Image::class,
'FCM' => LaravelFCM\Facades\FCM::class,
'FCMGroup' => LaravelFCM\Facades\FCMGroup::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
], ],
'token' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0XC9mYXZlby1oZWxwZGVzay1naXRodWJcL3B1YmxpY1wvYXBpXC92MVwvYXV0aGVudGljYXRlIiwiaWF0IjoxNDU1NzAyNDEyLCJleHAiOjE0NTU3MDYwMTIsIm5iZiI6MTQ1NTcwMjQxMiwianRpIjoiOTdlODg1ODNjOWQyNDIzNWQ4MzI3Y2ExNzI1NDY1MDQifQ.37E7H2kRCQuz5oBRkQLKhNNpaNXyk4FiEYS9RQ7HZPY',
'name' => 'faveo helpdesk community', 'name' => 'faveo helpdesk community',
]; ];

View File

@@ -2,6 +2,6 @@
return [ return [
'view' => '_partials/breadcrumbs', 'view' => '_partials.breadcrumbs',
]; ];

View File

@@ -50,9 +50,9 @@ return [
'mysql' => [ 'mysql' => [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'), 'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'), 'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME', 'forge'), 'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD'),
'charset' => 'utf8', 'charset' => 'utf8',
'collation' => 'utf8_unicode_ci', 'collation' => 'utf8_unicode_ci',
'port' => env('DB_PORT', ''), 'port' => env('DB_PORT', ''),

170
config/debugbar.php Normal file
View File

@@ -0,0 +1,170 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
*/
'enabled' => null,
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => array(
'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
),
/*
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
*/
'capture_ajax' => true,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => false,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => array(
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
),
/*
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
'options' => array(
'auth' => array(
'show_name' => false, // Also show the users name/email in the debugbar
),
'db' => array(
'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
'enabled' => false,
'types' => array('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(
'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
),
),
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before <body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => true,
/*
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => '_debugbar',
);

14
config/fcm.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
return [
'driver' => env('FCM_PROTOCOL','http'),
'log_enabled' => true,
'http' => [
'server_key' => env('FCM_SERVER_KEY','Your FCM server key'),
'sender_id' => env('FCM_SENDER_ID', 'Your sender id'),
'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

@@ -22,7 +22,7 @@ return [
| Defaults to 1 hour | Defaults to 1 hour
| |
*/ */
'ttl' => 60, 'ttl' => 4,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Refresh time to live | Refresh time to live

View File

@@ -1,18 +1,56 @@
<?php <?php
return [ return [
'rename_file' => true, // If true, the uploaded file will be renamed to uniqid() + file extension.
'use_package_routes' => true, 'rename_file' => true,
'middlewares' => ['auth'],
'allow_multi_user' => true, // If rename_file set to false and this set to true, then filter filename characters which are not alphanumeric.
'user_field' => 'id', 'alphanumeric_filename' => true,
'shared_folder_name' => 'shares',
'thumb_folder_name' => 'thumbs', 'use_package_routes' => true,
'images_dir' => 'public/photos/',
'images_url' => '%url%', // For laravel 5.2, please set to ['web', 'auth']
'files_dir' => 'public/files/', 'middlewares' => ['web'],
'files_url' => '/files/',
'file_type_array' => [ // Allow multi_user mode or not.
// If true, laravel-filemanager create private folders for each signed-in user.
'allow_multi_user' => true,
// The database field to identify a user.
// When set to 'id', the private folder will be named as the user id.
// NOTE: make sure to use an unique field.
'user_field' => 'id',
'shared_folder_name' => 'shares',
'thumb_folder_name' => 'thumbs',
//'images_dir' => 'public/photos/',
//'images_url' => '/photos/',
// 'files_dir' => 'public/files/',
// 'files_url' => '/files/',
// available since v1.3.0
'valid_image_mimetypes' => [
'image/jpeg',
'image/pjpeg',
'image/png',
'image/gif',
],
// available since v1.3.0
// only when '/laravel-filemanager?type=Files'
'valid_file_mimetypes' => [
'image/jpeg',
'image/pjpeg',
'image/png',
'image/gif',
'application/pdf',
'text/plain',
],
// file extensions array, only for showing file information, it won't affect the upload process.
'file_type_array' => [
'pdf' => 'Adobe Acrobat', 'pdf' => 'Adobe Acrobat',
'docx' => 'Microsoft Word', 'docx' => 'Microsoft Word',
'docx' => 'Microsoft Word', 'docx' => 'Microsoft Word',
@@ -26,7 +64,9 @@ return [
'ppt' => 'Microsoft PowerPoint', 'ppt' => 'Microsoft PowerPoint',
'pptx' => 'Microsoft PowerPoint', 'pptx' => 'Microsoft PowerPoint',
], ],
'file_icon_array' => [
// file extensions array, only for showing icons, it won't affect the upload process.
'file_icon_array' => [
'pdf' => 'fa-file-pdf-o', 'pdf' => 'fa-file-pdf-o',
'docx' => 'fa-file-word-o', 'docx' => 'fa-file-word-o',
'docx' => 'fa-file-word-o', 'docx' => 'fa-file-word-o',

View File

@@ -15,7 +15,7 @@ return [
| |
*/ */
'driver' => 'mail', 'driver' => 'smtp',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| SMTP Host Address | SMTP Host Address

View File

@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSendMailTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('send_mail', function (Blueprint $table) {
$table->increments('id');
$table->string('driver');
$table->string('host');
$table->string('port');
$table->string('encryption');
$table->string('name');
$table->string('email');
$table->string('password');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('send_mail');
}
}

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Version1079table extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$current_version1 = \Config::get('app.version');
$current_version2 = explode(' ', $current_version1);
$current_version = $current_version2[1];
$settings_system = DB::table('settings_system')->where('id', '=', '1')->first();
if($settings_system != null) {
DB::table('settings_system')->insert(['version' => $current_version]);
DB::table('common_settings')
->insert(
['option_name' => 'enable_rtl', 'option_value' => ''],
['option_name' => 'user_set_ticket_status', 'status' => 1]
);
}
}
}

View File

@@ -6,7 +6,6 @@ use App\Model\Common\TemplateType;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups; use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams; use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Email\Smtp;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan; use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Notification\NotificationType; use App\Model\helpdesk\Notification\NotificationType;
@@ -34,6 +33,8 @@ use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Version_Check; use App\Model\helpdesk\Utility\Version_Check;
use App\Model\helpdesk\Workflow\WorkflowClose; use App\Model\helpdesk\Workflow\WorkflowClose;
use App\Model\kb\Settings; use App\Model\kb\Settings;
use App\Model\helpdesk\Utility\Limit_Login;
use App\Model\Update\BarNotification;
// Knowledge base // Knowledge base
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@@ -46,7 +47,7 @@ class DatabaseSeeder extends Seeder
*/ */
public function run() public function run()
{ {
BarNotification::create(['id' => '1']);
/* Date time format */ /* Date time format */
$date_time_formats = [ $date_time_formats = [
'd/m/Y H:i:s', 'd/m/Y H:i:s',
@@ -272,8 +273,6 @@ class DatabaseSeeder extends Seeder
Ticket_source::create(['name' => 'web', 'value' => 'Web']); Ticket_source::create(['name' => 'web', 'value' => 'Web']);
Ticket_source::create(['name' => 'email', 'value' => 'E-mail']); Ticket_source::create(['name' => 'email', 'value' => 'E-mail']);
Ticket_source::create(['name' => 'agent', 'value' => 'Agent Panel']); Ticket_source::create(['name' => 'agent', 'value' => 'Agent Panel']);
/* Mail configuration */
Smtp::create(['id' => '1']);
/* Version check */ /* Version check */
Version_Check::create(['id' => '1']); Version_Check::create(['id' => '1']);
/* System widgets */ /* System widgets */
@@ -1978,7 +1977,7 @@ class DatabaseSeeder extends Seeder
Security::create(['id' => '1', 'lockout_message' => 'You have been locked out of application due to too many failed login attempts.', 'backlist_offender' => '0', 'backlist_threshold' => '15', 'lockout_period' => '15', 'days_to_keep_logs' => '0']); Security::create(['id' => '1', 'lockout_message' => 'You have been locked out of application due to too many failed login attempts.', 'backlist_offender' => '0', 'backlist_threshold' => '15', 'lockout_period' => '15', 'days_to_keep_logs' => '0']);
Limit_Login::create(['id'=>'1']);
TemplateSet::create(['id' => '1', 'name' => 'default', 'active' => '1']); TemplateSet::create(['id' => '1', 'name' => 'default', 'active' => '1']);
@@ -1994,23 +1993,24 @@ class DatabaseSeeder extends Seeder
TemplateType::create(['id' => '10', 'name' => 'ticket-reply-agent']); TemplateType::create(['id' => '10', 'name' => 'ticket-reply-agent']);
TemplateType::create(['id' => '11', 'name' => 'registration']); TemplateType::create(['id' => '11', 'name' => 'registration']);
Template::create(['id' => '1', 'variable' => '0', 'name' => 'This template is for sending notice to agent when ticket is assigned to them', 'type' => '1', 'message' => '<div>Hello {!!$ticket_agent_name!!},<br><br>Ticket No: {!!$ticket_number!!}<br>Has been assigned to you by {!!$ticket_assigner!!}&nbsp;<br><br>Thank You<br>Kind Regards,<br>{!!$system_from!!}</div>', 'set_id' => '1']); Template::create(['id' => '1', 'variable' => '0', 'name' => 'This template is for sending notice to agent when ticket is assigned to them', 'type' => '1', 'message' => '<div>Hello {!!$ticket_agent_name!!},<br/><br/><b>Ticket No:</b> {!!$ticket_number!!}<br/>Has been assigned to you by {!!$ticket_assigner!!} <br/><br/>Thank You<br/>Kind Regards,<br/> {!!$system_from!!}</div>', 'set_id' => '1']);
Template::create(['id' => '2', 'variable' => '1', 'name' => 'This template is for sending notice to client with ticket link to check ticket without logging in to system', 'type' => '2', 'subject' => 'Check your Ticket', 'message' => '<div>Hello {!!$user!!},<br><br>Click the link below to view your Requested ticket<br>{!!$ticket_link_with_number!!}<br><br>Kind Regards,<br>{!!$system_from!!} </div>', 'set_id' => '1']); Template::create(['id' => '2', 'variable' => '1', 'name' => 'This template is for sending notice to client with ticket link to check ticket without logging in to system', 'type' => '2', 'subject' => 'Check your Ticket', 'message' => '<div>Hello {!!$user!!},<br/><br/>Click the link below to view your requested ticket<br/> {!!$ticket_link_with_number!!}<br/><br/>Kind Regards,<br/> {!!$system_from!!}</div>', 'set_id' => '1']);
Template::create(['id' => '3', 'variable' => '0', 'name' => 'This template is for sending notice to client when ticket status is changed to close', 'type' => '3', 'message' => '<div>Hello,<br><br>This message is regarding your ticket ID {!!$ticket_number!!}. We are changing the status of this ticket to "Closed" as the issue appears to be resolved.<br><br>Thank you<br>Kind regards,<br> {!!$system_from!!} <br><br></div>', 'set_id' => '1']); Template::create(['id' => '3', 'variable' => '0', 'name' => 'This template is for sending notice to client when ticket status is changed to close', 'type' => '3', 'message' => '<div>Hello,<br/><br/>This message is regarding your ticket ID {!!$ticket_number!!}. We are changing the status of this ticket to "Closed" as the issue appears to be resolved.<br/><br/>Thank you<br/>Kind regards,<br/> {!!$system_from!!}</div>', 'set_id' => '1']);
Template::create(['id' => '4', 'variable' => '0', 'name' => 'This template is for sending notice to client on successful ticket creation', 'type' => '4', 'message' => '<div><span>Hello {!!$user!!}<br><br></span><span>Thank you for contacting us. This is an automated response confirming the receipt of your ticket. Our team will get back to you as soon as possible. When replying, please make sure that the ticket ID is kept in the subject so that we can track your replies.<br><br></span><span>Ticket ID: {!!$ticket_number!!}&nbsp;<br></span><span>{!!$department_sign!!}<br></span>You can check the status of or update this ticket online at: {!!$system_link!!}</div>', 'set_id' => '1']); Template::create(['id' => '4', 'variable' => '0', 'name' => 'This template is for sending notice to client on successful ticket creation', 'type' => '4', 'message' => '<div><span>Hello {!!$user!!}<br/><br/></span><span>Thank you for contacting us. This is an automated response confirming the receipt of your ticket. Our team will get back to you as soon as possible. When replying, please make sure that the ticket ID is kept in the subject so that we can track your replies.<br/><br/></span><span><b>Ticket ID:</b> {!!$ticket_number!!} <br/><br/></span><span> {!!$department_sign!!}<br/></span>You can check the status of or update this ticket online at: {!!$system_link!!}</div>', 'set_id' => '1']);
Template::create(['id' => '5', 'variable' => '0', 'name' => 'This template is for sending notice to agent on new ticket creation', 'type' => '5', 'message' => '<div>Hello {!!$ticket_agent_name!!}, &nbsp; &nbsp; &nbsp;&nbsp;<br><br>New ticket {!!$ticket_number!!} created&nbsp;<br>From<br>Name :- {!!$ticket_client_name!!} &nbsp; &nbsp;<br>E-mail :- {!!$ticket_client_email!!} &nbsp;&nbsp;<br><br>{!!$content!!} &nbsp;&nbsp;&nbsp;&nbsp;<br><br>Kind Regards,<br>{!!$system_from!!}</div><br>', 'set_id' => '1']); Template::create(['id' => '5', 'variable' => '0', 'name' => 'This template is for sending notice to agent on new ticket creation', 'type' => '5', 'message' => '<div>Hello {!!$ticket_agent_name!!},<br/><br/>New ticket {!!$ticket_number!!}created <br/><br/><b>From</b><br/><b>Name:</b> {!!$ticket_client_name!!}   <br/><b>E-mail:</b> {!!$ticket_client_email!!}<br/><br/> {!!$content!!}<br/><br/>Kind Regards,<br/> {!!$system_from!!}</div>', 'set_id' => '1']);
Template::create(['id' => '6', 'variable' => '0', 'name' => 'This template is for sending notice to client on new ticket created by agent in name of client', 'type' => '6', 'message' => '<div>{!!$content!!}<br><br>{!!$agent_sign!!}<br><br>You can check the status of or update this ticket online at: {!!$system_link!!}</div>', 'set_id' => '1']); Template::create(['id' => '6', 'variable' => '0', 'name' => 'This template is for sending notice to client on new ticket created by agent in name of client', 'type' => '6', 'message' => '<div> {!!$content!!}<br><br> {!!$agent_sign!!}<br><br>You can check the status of or update this ticket online at: {!!$system_link!!}</div>', 'set_id' => '1']);
Template::create(['id' => '7', 'variable' => '1', 'name' => 'This template is for sending notice to client on new registration during new ticket creation for un registered clients', 'type' => '7', 'subject' => 'Registration Confirmation', 'message' => '<span><p>Hello {!!$user!!} ,&nbsp;</p><p>This email is confirmation that you are now registered at our helpdesk.</p><p>Registered Email: {!!$email_address!!}</p><p>Password: {!!$user_password!!}</p><p>You can visit the helpdesk to browse articles and contact us at any time: {!!$system_link!!}</p><p>Thank You.</p><p>Kind Regards,</p><p>{!!$system_from!!}&nbsp;</p></span>', 'set_id' => '1']); Template::create(['id' => '7', 'variable' => '1', 'name' => 'This template is for sending notice to client on new registration during new ticket creation for un registered clients', 'type' => '7', 'subject' => 'Registration Confirmation', 'message' => '<p>Hello {!!$user!!}, </p><p>This email is confirmation that you are now registered at our helpdesk.</p><p><b>Registered Email:</b> {!!$email_address!!}</p><p><b>Password:</b> {!!$user_password!!}</p><p>You can visit the helpdesk to browse articles and contact us at any time: {!!$system_link!!}</p><p>Thank You.</p><p>Kind Regards,</p><p> {!!$system_from!!} </p>', 'set_id' => '1']);
Template::create(['id' => '8', 'variable' => '1', 'name' => 'This template is for sending notice to any user about reset password option', 'type' => '8', 'subject' => 'Reset your Password', 'message' => 'Hello {!!$user!!}<br/><br/>You asked to reset your password. To do so, please click this link:<br/><br/>{!!$password_reset_link!!}</a><br/><br/><br/>This will let you change your password to something new. If you did not ask for this, do not worry, we will keep your password safe.<br/><br/>Thank You.<br/><br/>Kind Regards,<br/><br/> {!!$system_from!!}', 'set_id' => '1']); Template::create(['id' => '8', 'variable' => '1', 'name' => 'This template is for sending notice to any user about reset password option', 'type' => '8', 'subject' => 'Reset your Password', 'message' => "Hello {!!$user!!},<br/><br/>You asked to reset your password. To do so, please click this link:<br/><br/> {!!$password_reset_link!!}<br/><br/>This will let you change your password to something new. If you didn't ask for this, don't worry, we'll keep your password safe.<br/><br/>Thank You.<br/><br/>Kind Regards,<br/> {!!$system_from!!}", 'set_id' => '1']);
Template::create(['id' => '9', 'variable' => '0', 'name' => 'This template is for sending notice to client when a reply made to his/her ticket', 'type' => '9', 'message' => '<span><div><span><p>{!!$content!!} &nbsp;&nbsp;<br></p><p>{!!$agent_sign!!}&nbsp;</p><p>Ticket Details</p><p>Ticket ID: {!!$ticket_number!!} &nbsp;&nbsp;&nbsp;&nbsp;</p><div><br></div></span><br></div><div><br></div></span>', 'set_id' => '1']); Template::create(['id' => '9', 'variable' => '0', 'name' => 'This template is for sending notice to client when a reply made to his/her ticket', 'type' => '9', 'message' => '<span></span><div><span></span><p> {!!$content!!}<br/></p><p> {!!$agent_sign!!} </p><p><b>Ticket Details</b></p><p><b>Ticket ID:</b> {!!$ticket_number!!}</p></div>', 'set_id' => '1']);
Template::create(['id' => '10', 'variable' => '0', 'name' => 'This template is for sending notice to agent when ticket reply is made by client on a ticket', 'type' => '10', 'message' => '<div>Hello {!!$ticket_agent_name!!},<b><br></b>A reply been made to ticket {!!$ticket_number!!}<b><br></b>From<br>Name: {!!$ticket_client_name!!}<br>E-mail: {!!$ticket_client_email!!}<b><br></b>{!!$content!!}<b><br></b>Kind Regards,<br>{!!$system_from!!}</div>', 'set_id' => '1']); Template::create(['id' => '10', 'variable' => '0', 'name' => 'This template is for sending notice to agent when ticket reply is made by client on a ticket', 'type' => '10', 'message' => '<div>Hello {!!$ticket_agent_name!!},<br/><b><br/></b>A reply been made to ticket {!!$ticket_number!!}<br/><b><br/></b><b>From<br/></b><b>Name: </b>{!!$ticket_client_name!!}<br/><b>E-mail: </b>{!!$ticket_client_email!!}<br/><b><br/></b> {!!$content!!}<br/><b><br/></b>Kind Regards,<br/> {!!$system_from!!}</div>', 'set_id' => '1']);
Template::create(['id' => '11', 'variable' => '1', 'name' => 'This template is for sending notice to client about registration confirmation link', 'type' => '11', 'subject' => 'Verify your email address', 'message' => '<span><p>Hello {!!$user!!} ,&nbsp;</p><p>This email is confirmation that you are now registered at our helpdesk.</p><p>Registered Email: {!!$email_address!!}</p><p>Please click on the below link to activate your account and Login to the system {!!$password_reset_link!!}</p><p>Thank You.</p><p>Kind Regards,</p><p>{!!$system_from!!}&nbsp;</p></span>', 'set_id' => '1']); Template::create(['id' => '11', 'variable' => '1', 'name' => 'This template is for sending notice to client about registration confirmation link', 'type' => '11', 'subject' => 'Verify your email address', 'message' => '<p>Hello {!!$user!!}, </p><p>This email is confirmation that you are now registered at our helpdesk.</p><p><b>Registered Email:</b> {!!$email_address!!}</p><p>Please click on the below link to activate your account and Login to the system {!!$password_reset_link!!}</p><p>Thank You.</p><p>Kind Regards,</p><p> {!!$system_from!!} </p>', 'set_id' => '1']);
/* /*
* All the common settings will be listed here * All the common settings will be listed here
*/ */
CommonSettings::create(['id' => '1', 'option_name' => 'ticket_token_time_duration', 'option_value' => '1']); CommonSettings::create(['id' => '1', 'option_name' => 'ticket_token_time_duration', 'option_value' => '1']);
CommonSettings::create(['id' => '2', 'option_name' => 'enable_rtl', 'option_value' => '']);
CommonSettings::create(['id' => '3', 'option_name' => 'user_set_ticket_status', 'status' => 1]);
/* /*
* Ratings * Ratings

View File

@@ -1,18 +0,0 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=SomeRandomString
DB_TYPE=
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_INSTALL=%0%
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

View File

@@ -1,5 +0,0 @@
suites:
main:
namespace: App
psr4_prefix: App
src_path: app

View File

@@ -4,7 +4,7 @@
</IfModule> </IfModule>
RewriteEngine On RewriteEngine On
# Redirect Trailing Slashes... # Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteRule ^(.*)/$ /$1 [L,R=301]
@@ -13,3 +13,22 @@
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L] RewriteRule ^ index.php [L]
</IfModule> </IfModule>
# Restrict access to DotFiles (like .htaccess, .env, .gitignore....)
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>
# Restrict access to system files
<FilesMatch "^(composer.json|composer.lock|artisan|code_of_conduct.md|gulpfile.js|package.json|error_log|phpspec.yml|example.env)">
Order allow,deny
Deny from all
</FilesMatch>
# Uncomment to restrict access to release text files
#<FilesMatch "^(LICENSE|README.md|readme.txt|release-notes.txt)">
# Order allow,deny
# Deny from all
#</FilesMatch>

View File

@@ -1,10 +0,0 @@
[24-Jul-2015 12:08:05 UTC] PHP Warning: Uncaught exception 'ErrorException' with message 'Undefined variable: router' in /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php:260
Stack trace:
#0 /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php(260): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/home/faveohelp...', 260, Array)
#1 [internal function]: App\Providers\RouteServiceProvider->{closure}(Object(Illuminate\Routing\Router))
#2 /home/faveohelpdesk/public_html/demo/local/vendor/laravel/framework/src/Illuminate/Routing/Router.php(352): call_user_func(Object(Closure), Object(Illuminate\Routing\Router))
#3 /home/faveohelpdesk/public_html/demo/local/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(213): Illuminate\Routing\Router->group(Array, Object(Closure))
#4 /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php(277): Illuminate\Support\Facades\Facade::__callStatic('group', Array)
#5 /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php(277): Ill in /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php on line 260
[24-Jul-2015 12:08:05 UTC] PHP Fatal error: Call to a member function get() on a non-object in /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php on line 260
[27-Jul-2015 10:50:41 UTC] PHP Parse error: syntax error, unexpected end of file in /home/faveohelpdesk/public_html/demo/local/storage/framework/views/dfc79cb1d1ad74c39ab1adc75b4db873 on line 214

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1 +0,0 @@
scripts/filemanager.config.js

View File

@@ -1,479 +0,0 @@
Filemanager
========================
FM is an open-source file manager released under MIT license. It is an alternative to elfinder or CKFinder.
Support
-------
Filemanager is under free license. If you want to support the filemanager development or just thank its main maintainer by paying a beer, you can make a donation by clicking the following button :
[![Donate](https://www.paypal.com/en_US/i/btn/x-click-but21.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2M5GWH9NLNEZL)
Main features
-------------
* A Filemanager relying on jquery.
* Available in more than 20 languages.
* [Highly customizable](https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file)
* Can work as standalone application
* Easy integration with RTE like CKEditor, TinyMCE and so on.
* Easy integration with [colorbox jquery plugin](https://github.com/simogeo/Filemanager/wiki/How-to-use-the-filemanager-with-colorbox-%3F) or [HTML simple textfield](https://github.com/simogeo/Filemanager/wiki/How-to-use-the-filemanager-from-a-simple-textfield-%3F)
* Several computer language connectors available. **PHP is up-to-date**
* Ability to upload, delete, modify, download and move files
* Ability to create folders
* Support user permissions - based on session
* Handle system permissions
* Ability to pass config user file in URL
* Multiple uploads support - based on [dropzonejs](http://www.dropzonejs.com)
* Online text / code edition - based on [codeMirror](http://codemirror.net/)
* Online documents viewer - based on [viewerJS](http://viewerjs.org/)
* [Opening a given folder](https://github.com/simogeo/Filemanager/wiki/How-to-open-a-given-folder-different-from-root-folder-when-opening-the-filemanager%3F)
* [Opening exclusively a given folder](https://github.com/simogeo/Filemanager/wiki/How-to-open-%28exclusively%29-a-given-subfolder-%3F)
* [Passing parameters to the FM](https://github.com/simogeo/Filemanager/wiki/Passing-parameters-to-the-FM)
* [File types restriction](https://github.com/simogeo/Filemanager/wiki/Set-up-upload-restriction-on-file-type)
* Video and audio player relying on web browser capabilities
* Textbox Search filter
* Thumbnails generation
* Image auto-resize
* File size limit
* File exclusion based on name and patterns
* Images files only
* Prevent files overwriting (or not)
* Switch from list to grid view and vice-versa
* Copy direct file URL
* [CSS Themes](https://github.com/simogeo/Filemanager/wiki/Create-your-own-theme) - **Please, share your themes with others !**
* and more ...
Screenshot
-------------
![Filemanager Screenshot](http://i57.tinypic.com/35cqw74.png)
Documentation
-------------
Filemanager is highly documented on the [wiki pages](https://github.com/simogeo/Filemanager/wiki). API, see below.
Installation and Setup
----------------------
**Preamble**
Since many changes have been done recently, only PHP and MVC connectors are now available. You can try the latest version for others connectors, but with no warranty they implement all features and work correctly.
To use other connectors, please download v0.8 version from https://github.com/simogeo/Filemanager/archive/v0.8.zip
(PHP, ASHX, ASP, CFM, lasso, PL and JSP connectors are available)
A JSP/Java connector implementation is available at : https://github.com/th-schwarz/C5Connector.Java
---
**(1)** Check out a copy of the FileManager from the repository using Git :
git clone http://github.com/simogeo/Filemanager.git
or download the archive from Github : https://github.com/simogeo/Filemanager/archive/master.zip
You can place the FileManager anywhere within your web serving root directory.
**(2)** Make a copy of the default configuration file ("filemanager.config.js.default" located in the scripts directory), removing the '.default' from the end of the filename, and edit the options according to the following wiki page : https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file
Having a look on configuration cases study may also be helpful to you : https://github.com/simogeo/Filemanager/wiki/Specify-user-folder%2C-configuration-cases
**(3a)** If you are integrating the FileManager with FCKEditor, open your fckconfig.js file and find the lines which specify what file browser to use for images, links, etc. Look toward the bottom of the file. You will need to change lines such as this:
```javascript
FCKConfig.ImageBrowser = false ;
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=../../connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
```
...to this:
```javascript
FCKConfig.ImageBrowser = true ;
FCKConfig.ImageBrowserURL = '[Path to Filemanager]/index.html' ;
```
**(3b)** If you are integrating the FileManager with CKEditor 3.x or higher, simply set the URL when you configure your instance, like so:
```javascript
CKEDITOR.replace('instancename', {
filebrowserBrowseUrl: '[Path to Filemanager]/index.html',
...other configuration options...
});
```
If you want to use the **modal dialog mode** (instead of pop-up), please refer to [the dedicated wiki page](https://github.com/simogeo/Filemanager/wiki/How-to-open-the-Filemanager-from-CKEditor-in-a-modal-window-%3F).
**(3c)** If you are integrating the FileManager with TinyMCE (>= 3.0), you should:
Create a Javascript callback function that will open the FileManager index.html base page (see URL below for examples)
Add a line like: "file_browser_callback : 'name_of_callback_function'" in the tinyMCE.init command
See http://www.tinymce.com/wiki.php/TinyMCE3x:How-to_implement_a_custom_file_browser for more details.
See also the dedicated wiki page, with TinyMCE 4 sample : https://github.com/simogeo/Filemanager/wiki/How-to-use-the-Filemanager-with-tinyMCE--3-or-4-%3F
**(4)** Last but not least, **worry about security**!
For **PHP connector** : copy/paste the `/connectors/php/default.config.php` to `/connectors/php/user.config.php` to define your own authentication function.
To do so, you will find an example on the [dedicated wiki page](https://github.com/simogeo/Filemanager/wiki/Security-concern).
**jQuery dependency and compatibility**
We try to keep updating jQuery core library regularly.
If, for any reason, you can't use the embedded jQuery version just now that the Filemanager will probably work with a jQuery version >= 1.6.
You'll have to use the [jQuery.migrate() plugin](https://github.com/jquery/jquery-migrate) to use it with jQuery version 1.9+.
Set-up & security
-----------------
**Important** : The Filemanager is designed to work without any special configuration but **using it without any configuration is VERY unsafe**.
Please set-up your own **authentication function**, based on [default file](https://github.com/simogeo/Filemanager/blob/master/connectors/php/default.config.php) and refering to the [dedicated wiki page](https://github.com/simogeo/Filemanager/wiki/Security-concern).
API
---
Connector Location
------------------
You can create a connector for your server side language of choice by following this simple API. You must have a script at the following location which can respond to HTTP GET requests by returning an appropriate JSON object:
[path to FileManager]/connectors/[language extension]/filemanager.[language extension]
FileManager currently includes connectors for PHP, MVC, JSP, lasso, ASP, ASHX, PL and CFM in the following locations:
PHP: .../connectors/php/filemanager.php
ASP.NET MVC Framework .../connectors/mvc/FilemanagerController.cs
JSP: .../connectors/jsp/filemanager.jsp
lasso: .../connectors/lasso/filemanager.lasso
ASP: .../connectors/asp/filemanager.asp
ASHX: .../connectors/ashx/filemanager.asp
PL: .../connectors/pl/filemanager.pl
CFM: .../connectors/cfm/filemanager.cfm
As long as a script exists at this location to respond to requests, you may split up the code (external libraries, configuration files, etc.) however you see fit.
Error Handling
--------------
Every response should include two keys specific to error handling: Error, and Code. If an error occurs in your script, you may populate these keys with whatever values you feel are most appropriate. If there is no error, Error should remain empty or null, and Code should be empty, null, or zero (0). Do not use zero for any actual errors. The following example would be an appropriate response if the connector uses an external file for configuration (recommended), but that file cannot be found:
{
"Error": "Configuration file missing.",
"Code": -1
}
Methods
-------
Your script should include support for the following methods/functions. GET requests from FileManager include a parameter "mode" which will indicate which type of response to return. Additional parameters will provide other information required to fulfill the request, such as the current directory.
getinfo
-------
The `getinfo` method returns information about a single file. Requests with mode "getinfo" will include an additional parameter, "path", indicating which file to inspect. A boolean parameter "getsize" indicates whether the dimensions of the file (if an image) should be returned.
Example Request:
[path to connector]?mode=getinfo&path=/UserFiles/Image/logo.png&getsize=true
Example Response:
{
"Path": "/UserFiles/Image/logo.png",
"Filename": "logo.png",
"File Type": "png",
"Preview": "/UserFiles/Image/logo.png",
"Protected": 0,
"Properties": {
"Date Created": null,
"Date Modified": "02/09/2007 14:01:06",
"filemtime": 1360237058,
"Height": 14,
"Width": 14,
"Size": 384
},
"Error": "",
"Code": 0
}
The keys are as follows:
Path: The path to the file. Should match what was passed in the request.
Filename: The name of the file, i.e., the last part of the path.
File Type: The file extension, "dir" if a directory, or "txt" if missing/unknown.
Preview: Path to a preview image. If the file is an image that can be displayed in a web browser (i.e., gif, jpg, or png), you should return the path to the image. Otherwise, check to see if there is a matching file icon based on the file extension, constructing the path like so:
Directories: images/fileicons/_Open.png
Files: images/fileicons/[extension].png
Unknown: images/fileicons/default.png
Protected: Indicates if the file has some reading / writing restrictions. If not, set to 0. Else set to 1.
Properties: A nested JSON object containing specific properties of the file.
Date Created: The file's creation date, if available.
Date Modified: The file's modification date, if available.
Height: If an image, the height in pixels.
Width: If an image, the width in pixels.
Size: The file size in bytes.
Capabilities (optional): You can limit the operation buttons shown for a specific file. It is an array containing ['select','delete','rename','download'] (for all capabilities), or [] (for no capabilities). If not present, all capabilities are enabled.
Error: An error message, or empty/null if there was no error.
Code: An error code, or 0 if there was no error.
getfolder
---------
The `getfolder` method returns an array of file and folder objects representing the contents of the given directory (indicated by a "path" parameter). It should call the getinfo method to retrieve the properties of each file. A boolean parameter "getsizes" indicates whether image dimensions should be returned for each item. Folders should always be returned before files.
Optionally a "type" parameter can be specified to restrict returned files (depending on the connector). If a "type" parameter is given for the main index.html URL, the same parameter value is reused and passed to getfolder. This can be used for example to only show image files in a file system tree.
Example Request:
[path to connector]?mode=getfolder&path=/UserFiles/Image/&getsizes=true&type=images
Example Response:
{
"/UserFiles/Image/logo.png": {
"Path": "/UserFiles/Image/logo.png",
"Filename": "logo.png",
"File Type": "png",
"Preview": "/UserFiles/Image/logo.png",
"Protected": 0,
"Properties": {
"Date Created": null,
"Date Modified": "02/09/2007 14:01:06",
"filemtime": 1360237058,
"Height": 14,
"Width": 14,
"Size": 384
},
"Error": "",
"Code": 0
},
"/UserFiles/Image/icon.png": {
"Path": "/UserFiles/Image/icon.png",
"Filename": "icon.png",
"File Type": "png",
"Preview": "/UserFiles/Image/icon.png",
"Properties": {
"Date Created": null,
"Date Modified": "02/09/2007 14:01:06",
"filemtime": 1360237058,
"Height": 14,
"Width": 14,
"Size": 384
},
"Error": "",
"Code": 0
},
"/UserFiles/folder/":{
"Path":"/UserFiles/folder/",
"Filename":"folder",
"File Type":"dir",
"Preview":"images\/fileicons\/_Open.png",
"Properties": {
"Date Created":null,
"Date Modified": "02/09/2007 14:01:06",
"filemtime": 1360237058,
"Height":null,
"Width":null,
"Size":null
},
"Error":"",
"Code":0
}
}
Each key in the array is the path to an individual item, and the value is the file object for that item.
rename
------
The `rename` method renames the item at the path given in the "old" parameter with the name given in the "new" parameter and returns an object indicating the results of that action.
Example Request:
[path to connector]?mode=rename&old=/UserFiles/Image/logo.png&new=id.png
Example Response:
{
"Error": "No error",
"Code": 0,
"Old Path": "/a_folder_renamed/thisisareallylongincrediblylongfilenamefortesting.txt",
"Old Name": "thisisareallylongincrediblylongfilenamefortesting.txt",
"New Path": "/a_folder_renamed/a_renamed_file",
"New Name": "a_renamed_file"
}
move
------
The `move` method move "old" file or directory to specified "new" directory. It is possible to specify absolute path from fileRoot dir or relative path from "old" item. "root" value is mandatory to secure that relative paths don't get above fileRoot.
Example Request: Move file
[path to connector]?mode=move&old=/uploads/images/original/Image/logo.png&new=/moved/&root=/uploads/images/
Example Response:
{
"Error": "No error",
"Code": 0,
"Old Path": "/uploads/images/original/Image/",
"Old Name": "logo.png",
"New Path": "/uploads/images/moved/",
"New Name": "logo.png"
}
Example Request: Move directory to not existing directory (will be created)
[path to connector]?mode=move&old=/uploads/images/original/Image&new=../new_dir/&root=/uploads/images/
Example Response:
{
"Error": "No error",
"Code": 0,
"Old Path": "/uploads/images/original/",
"Old Name": "Image",
"New Path": "/uploads/new_dir/",
"New Name": "Image"
}
delete
------
The `delete` method deletes the item at the given path.
Example Request:
[path to connector]?mode=delete&path=/UserFiles/Image/logo.png
Example Response:
{
"Error": "No error",
"Code": 0,
"Path": "/UserFiles/Image/logo.png"
}
add
---
The `add` method adds the uploaded file to the specified path. Unlike the other methods, this method must return its JSON response wrapped in an HTML <textarea>, so the MIME type of the response is text/html instead of text/plain. The upload form in the File Manager passes the current path as a POST param along with the uploaded file. The response includes the path as well as the name used to store the file. The uploaded file's name should be safe to use as a path component in a URL, so URL-encoded at a minimum.
Example Response:
{
"Path": "/UserFiles/Image/",
"Name": "new_logo.png",
"Error": "No error",
"Code": 0
}
replace
---
The `replace` method allow the user to replace a specific file whatever the new filename - at least, the new file should have the same extension the original has. The old file is automatically overwritten. Unlike the other methods, this method must return its JSON response wrapped in an HTML <textarea>, so the MIME type of the response is text/html instead of text/plain. The *dynamic* upload form in the File Manager passes the current file path as a POST param along with the uploaded file. The response includes the path as well as the name used to store the file.
Example Response:
{
"Path": "/UserFiles/Image/",
"Name": "new_logo.png",
"Error": "No error",
"Code": 0
}
editfile
--------
The `editfile` method returns the content of a given file (passed as parameter). It gives the user the ability to edit a file online (extensions are specified in configuration file). Handled as GET request.
Example request:
[path to connector]?mode=editfile&path=/UserFiles/MyFolder/myfile.txt
Example Response:
{
"Error": "No error",
"Code": 0,
"Path": "/UserFiles/MyFolder/myfile.txt",
"Content": "Content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\r\n\Phasellus eu erat lorem.\r\n\r\n\Bye!"
}
savefile
--------
The `save` method will overwrite the content of the current file. The edit form in the File Manager passes the mode (as `savefile`), path of the current file and the content as POST parameters.
Example Response:
{
"Error": "No error",
"Code": 0,
"Path": "/UserFiles/MyFolder/myfile.txt"
}
preview
--------
The `preview` method serves the requested image for displaying. The image path is passed through the `path` parameter. If `thumbnail=true` parameter is passed, the method will return an image thumbnail. An extra parameter such as UNIX time can be added to the URL to prevent cache issue.
Example Request:
[path to connector]?mode=preview&path=/UserFiles/new%20logo.png&thumbnail=true
addfolder
---------
The `addfolder` method creates a new directory on the server within the given path.
Example Request:
[path to connector]?mode=addfolder&path=/UserFiles/&name=new%20logo.png
Example Response:
{
"Parent": "/UserFiles/",
"Name": "new_logo.png",
"Error": "No error",
"Code": 0
}
download
--------
The `download` method serves the requested file to the user. We currently use a MIME type of "application/x-download" to force the file to be downloaded rather than displayed in a browser. In the future we may make exceptions for specific file types that often have in-browser viewers such as PDF's and various movie formats (Flash, Quicktime, etc.).
Example Request:
[path to connector]?mode=download&path=/UserFiles/new%20logo.png
MIT LICENSE
---
Copyright (c) 2011-2013 Jason Huck, Simon Georget
http://opensource.org/licenses/MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,11 +0,0 @@
{
"name": "Filemanager",
"repo": "simogeo/Filemanager",
"description": "An open-source file manager released under MIT license. Up-to-date for PHP and MVC connector.",
"keywords": ["file", "upload", "dms", "document", "management", "system"],
"dependencies": {},
"development": {},
"main": [
"index.html"
]
}

View File

@@ -1,87 +0,0 @@
From version 2.2.0 to 2.3.0
---------------------------
- PDF viewer added | #377 & #319
- fix is_valid_path bug when fileRoot is defined | #393
- adding https protocol for external resources | #395
- array_replace_recursive function implementation for php 5.2 compatibility | #396
- ASHX connector, fixing test bug | #399
- security fix related to WideImage lib | #405
- filemanager.ashx update | #409
- fix uploadRestrictions bug | #398
- ability to do not cache thumbnails | #417
- encode folder name when adding | #420
- ability to set panels size | #423
- ability to pass configuration file in url | #255
- ability to make Text editor fullscreen (by pressing F11) | #422
From version 2.1.0 to 2.2.0
---------------------------
- handle symlinks | #332
- bug fix : prevent "flickering" on image resize with custom-scrollbar | #334
- make relPath and connector setFileRoot() work together | #339
- relPath renamed baseUrl | #340
- adding .jpe extension support | #341
- update jquery | #345
- remove unused option maxuploadfilesize | #346
- set logfile path according to system if not set into config file | #353
- fix bug when using baseUrl without calling setFileRoot() | #354
- fix important security issue | #356
From version 2.0.0 to 2.1.0
---------------------------
- Detect syntax error in config file | #294
- "Upload" button localized | #295
- Adding loading screen | #298
- Adding version number | #292
- Adding navigation to Parent Directory | #315
- Better handling of non readable / non writable files and folders, depending on system permissions | #307, #308, #309
- Fixing bug with custom scrollbar on Google Chrome | #299
- Fixing bug when renaming file/folder with dynamic fileroot, using setFileRoot() | #297
- Fixing bug on 'upload' button when multiple-uploads option is enabled, on chrome. Should also work better with IE | #304
- Fixing bug is_valid_path() on WAMP | #306
- Fixing bug on filetree scrollbar | #302
- Fixing bug on clicking Home button | #320
- Fixing bug on allowed files test | #331
From version 1.8.0 to 2.0.0
---------------------------
- Adding multiple files upload, based on dropzone.js | #177, #185, #41
- Fixing bugs after 'Rename' action | #283, #284
- Adding logo | #285
- Adding folder infos | #287
- Adding help message on 'Move' action
- Code optimization
From version 1.7.0 to 1.8.0
---------------------------
- Adding Bosnian transalation | #281
- Security enhanced | #282 and much more
- Removing ability to move file to parent path using '../' syntax
- Ability to zip and download folder | #100
From version 1.6.0 to 1.7.0
---------------------------
- Add timer when logger is enabled #278
- Let user tweak scrollbar if wanted. See config.customScrollbar options | #279
- Add new themes : 'flat-dark' (as default), 'flat-turquoise', 'flat-oil'
From version 1.5.0 to 1.6.0
---------------------------
- Add ability to define your own CSS theme | #277
From version 1.4.0 to 1.5.0
---------------------------
- Add ability to copy direct file URL | #276
From version 1.3.0 to 1.4.0
---------------------------
- Modal dialog available for CKEditor | #205
- Security : checking for permissions before executing actions | #251
- Removing regex modifiers in config file to ease other languages portability
- Supporting extension changes ('rename' action) | #247, #249

View File

@@ -1,22 +0,0 @@
{
"name":"simogeo/filemanager",
"description":"An open-source file manager",
"type":"project",
"keywords":[
"filemanager",
"files",
"images"
],
"license": "MIT",
"authors":[
{
"name":"Simon Georget",
"email":"simon@linea21.com",
"homepage":"http://www.empreinte-urbaine.eu",
"role": "Developer"
}
],
"require":{
"php":">= 5.2.0"
}
}

Some files were not shown because too many files have changed in this diff Show More