update v1.0.7.9 R.C.
This is a Release Candidate. We are still testing.
This commit is contained in:
19
.gitignore
vendored
19
.gitignore
vendored
@@ -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.json
|
||||
/nbproject/private/
|
||||
.env
|
||||
/app/Plugins/ServiceDesk/
|
||||
/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
20
.htaccess
Normal 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>
|
||||
|
@@ -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
|
||||
|======================================
|
||||
|
@@ -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
|
||||
(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_password_resets_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_auto_response_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`
|
||||
--
|
||||
@@ -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
|
||||
(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');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@@ -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
|
||||
(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_password_resets_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_auto_response_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`
|
||||
--
|
||||
@@ -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
|
||||
(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');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
8
DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql
Normal file
8
DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql
Normal 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
|
@@ -23,7 +23,8 @@ class BaseModel extends Model
|
||||
File::makeDirectory($path, $mode = 0777, true, true);
|
||||
}
|
||||
$config = \HTMLPurifier_Config::createDefault();
|
||||
//dd($config);
|
||||
$config->set('HTML.Trusted', true);
|
||||
$config->set('Filter.YouTube', true);
|
||||
$purifier = new \HTMLPurifier($config);
|
||||
if ($value != strip_tags($value)) {
|
||||
$value = $purifier->purify($value);
|
||||
|
56
app/Console/Commands/SendReport.php
Normal file
56
app/Console/Commands/SendReport.php
Normal 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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
// controller
|
||||
use Bugsnag;
|
||||
//use Illuminate\Validation\ValidationException;
|
||||
@@ -13,7 +11,6 @@ use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Validation\ValidationException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
@@ -23,26 +20,13 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
protected $dontReport = [
|
||||
// 'Symfony\Component\HttpKernel\Exception\HttpException',
|
||||
Illuminate\Http\Exception\HttpResponseException::class,
|
||||
\Illuminate\Http\Exception\HttpResponseException::class,
|
||||
ValidationException::class,
|
||||
AuthorizationException::class,
|
||||
HttpResponseException ::class,
|
||||
ModelNotFoundException::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.
|
||||
*
|
||||
@@ -60,73 +44,12 @@ class Handler extends ExceptionHandler
|
||||
Bugsnag::setBeforeNotifyFunction(function ($error) {
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
$version = \Config::get('app.version');
|
||||
Bugsnag::setAppVersion($version);
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
@@ -148,7 +71,6 @@ class Handler extends ExceptionHandler
|
||||
return $this->common($request, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to render 500 error page.
|
||||
*
|
||||
@@ -162,10 +84,9 @@ class Handler extends ExceptionHandler
|
||||
if (config('app.debug') == true) {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
return redirect()->route('error500', []);
|
||||
return response()->view('errors.500');
|
||||
//return redirect()->route('error500', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to render 404 error page.
|
||||
*
|
||||
@@ -176,13 +97,38 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
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) {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
return redirect()->route('error404', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Common finction to render both types of codes.
|
||||
*
|
||||
@@ -198,10 +144,21 @@ class Handler extends ExceptionHandler
|
||||
return $this->render404($request, $e);
|
||||
case $e instanceof NotFoundHttpException:
|
||||
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:
|
||||
return $this->render500($request, $e);
|
||||
}
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
}
|
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\AgentRequest;
|
||||
use App\Http\Requests\helpdesk\AgentUpdate;
|
||||
@@ -139,6 +139,7 @@ class AgentController extends Controller
|
||||
// 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]);
|
||||
@@ -146,6 +147,7 @@ class AgentController extends Controller
|
||||
// returns if try fails
|
||||
return redirect('agents')->with('warning', Lang::get('lang.agent_send_mail_error_on_agent_creation'));
|
||||
}
|
||||
}
|
||||
// returns for the success case
|
||||
return redirect('agents')->with('success', Lang::get('lang.agent_creation_success'));
|
||||
} else {
|
||||
|
@@ -54,7 +54,7 @@ class CloseWrokflowController extends Controller
|
||||
$security = new WorkflowClose();
|
||||
$securitys = $security->whereId($id)->first();
|
||||
$securitys->days = $request->input('days');
|
||||
// $securitys->condition = $request->input('condition');
|
||||
// $securitys->condition = $request->input('condition');
|
||||
$securitys->send_email = $request->input('send_email');
|
||||
$securitys->status = $request->input('status');
|
||||
$securitys->save();
|
||||
|
@@ -29,15 +29,14 @@ use Lang;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
@@ -49,11 +48,9 @@ class DepartmentController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Department $department)
|
||||
{
|
||||
public function index(Department $department) {
|
||||
try {
|
||||
$departments = $department->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -73,8 +70,7 @@ class DepartmentController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group)
|
||||
{
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) {
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent2')->get();
|
||||
@@ -97,8 +93,7 @@ class DepartmentController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Department $department, DepartmentRequest $request)
|
||||
{
|
||||
public function store(Department $department, DepartmentRequest $request) {
|
||||
try {
|
||||
$department->fill($request->except('group_id', 'manager', 'sla'))->save();
|
||||
if ($request->sla) {
|
||||
@@ -116,6 +111,11 @@ class DepartmentController extends Controller
|
||||
/* Succes And Failure condition */
|
||||
/* Check Whether the function Success or Fail */
|
||||
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'));
|
||||
} else {
|
||||
return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department'));
|
||||
@@ -140,8 +140,7 @@ class DepartmentController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group)
|
||||
{
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) {
|
||||
try {
|
||||
$sys_department = \DB::table('settings_system')
|
||||
->select('department')
|
||||
@@ -171,8 +170,7 @@ class DepartmentController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request)
|
||||
{
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
|
||||
// dd($id);
|
||||
try {
|
||||
$table = $group_assign_department->where('department_id', $id);
|
||||
@@ -220,9 +218,9 @@ class DepartmentController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets)
|
||||
{
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) {
|
||||
// try {
|
||||
|
||||
$system = $system->where('id', '=', '1')->first();
|
||||
if ($system->department == $id) {
|
||||
return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department'));
|
||||
@@ -234,7 +232,7 @@ class DepartmentController extends Controller
|
||||
} else {
|
||||
$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 {
|
||||
$ticket = '';
|
||||
}
|
||||
@@ -245,7 +243,7 @@ class DepartmentController extends Controller
|
||||
} else {
|
||||
$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 {
|
||||
$user = '';
|
||||
}
|
||||
@@ -256,27 +254,28 @@ class DepartmentController extends Controller
|
||||
} else {
|
||||
$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 {
|
||||
$email = '';
|
||||
}
|
||||
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
|
||||
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 {
|
||||
$helptopic = '';
|
||||
}
|
||||
$message = $ticket.$user.$email.$helptopic;
|
||||
$message = $ticket . $user . $email . $helptopic;
|
||||
/* Becouse of foreign key we delete group_assign_department first */
|
||||
$group_assign_department = $group_assign_department->where('department_id', $id);
|
||||
$group_assign_department->delete();
|
||||
$departments = $department->whereId($id)->first();
|
||||
/* Check the function is Success or Fail */
|
||||
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 {
|
||||
return redirect('departments')->with('fails', Lang::get('lang.department_can_not_delete'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -498,7 +498,7 @@ class EmailsController extends Controller
|
||||
$mailbox_protocol = $fetching_encryption2;
|
||||
$host = $request->input('fetching_host');
|
||||
$port = $request->input('fetching_port');
|
||||
$mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX';
|
||||
$mailbox = '{'.$host.':'.$port.$fetching_protocol.$mailbox_protocol.'}INBOX';
|
||||
} else {
|
||||
$mailbox_protocol = $fetching_protocol.$fetching_encryption;
|
||||
$host = $request->input('fetching_host');
|
||||
|
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// Controller
|
||||
use App\Http\Controllers\Controller;
|
||||
// Model
|
||||
@@ -14,7 +12,6 @@ use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
* This controller is used to CRUD Custom Forms.
|
||||
@@ -25,14 +22,12 @@ class FormController extends Controller
|
||||
{
|
||||
private $fields;
|
||||
private $forms;
|
||||
|
||||
public function __construct(Fields $fields, Forms $forms)
|
||||
{
|
||||
$this->fields = $fields;
|
||||
$this->forms = $forms;
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* home.
|
||||
*
|
||||
@@ -42,7 +37,6 @@ class FormController extends Controller
|
||||
{
|
||||
return view('forms.home');
|
||||
}
|
||||
|
||||
/**
|
||||
* list of forms.
|
||||
*
|
||||
@@ -58,7 +52,6 @@ class FormController extends Controller
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new form.
|
||||
*
|
||||
@@ -72,7 +65,6 @@ class FormController extends Controller
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a new form.
|
||||
*
|
||||
@@ -88,7 +80,6 @@ class FormController extends Controller
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a new form.
|
||||
*
|
||||
@@ -124,10 +115,8 @@ class FormController extends Controller
|
||||
}
|
||||
}
|
||||
Fields::insert($fields);
|
||||
|
||||
return Redirect::back()->with('success', Lang::get('lang.successfully_created_form'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Form.
|
||||
*
|
||||
@@ -151,7 +140,6 @@ class FormController extends Controller
|
||||
}
|
||||
$forms = $forms->where('id', $id)->first();
|
||||
$forms->delete();
|
||||
|
||||
return redirect()->back()->with('success', Lang::get('lang.form_deleted_successfully'));
|
||||
}
|
||||
}
|
@@ -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
|
||||
*
|
||||
@@ -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 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 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 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 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 Help_topic $topic
|
||||
|
@@ -98,7 +98,12 @@ class LanguageController extends Controller
|
||||
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
|
||||
return \Datatable::collection(new Collection($values))
|
||||
->addColumn('language', function ($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) {
|
||||
return $model;
|
||||
@@ -228,6 +233,7 @@ class LanguageController extends Controller
|
||||
public function deleteLanguage($lang)
|
||||
{
|
||||
if ($lang !== App::getLocale()) {
|
||||
if ($lang !== Config::get('app.fallback_locale')) {
|
||||
$deletePath = base_path('resources/lang').'/'.$lang; //define file path to delete
|
||||
$success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang
|
||||
if ($success) {
|
||||
@@ -242,10 +248,14 @@ class LanguageController extends Controller
|
||||
return Redirect::back();
|
||||
}
|
||||
} else {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.lang-fallback-lang'));
|
||||
return redirect('languages');
|
||||
}
|
||||
} else {
|
||||
Session::flash('fails', Lang::get('lang.active-lang-error'));
|
||||
|
||||
return redirect('languages');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -64,10 +64,10 @@ class SecurityController extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.setting.security.preview', compact('id'));
|
||||
}
|
||||
// public function show($id)
|
||||
// {
|
||||
// return view('themes.default1.admin.helpdesk.setting.security.preview', compact('id'));
|
||||
// }
|
||||
|
||||
/**
|
||||
* Update security details.
|
||||
|
@@ -30,6 +30,7 @@ use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Workflow\WorkflowClose;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use DateTime;
|
||||
// classes
|
||||
use DB;
|
||||
@@ -93,7 +94,7 @@ class SettingsController extends Controller
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/media/company/';
|
||||
$destinationPath = 'uploads/company/';
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
@@ -145,7 +146,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @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 {
|
||||
/* fetch the values of system from system table */
|
||||
@@ -154,11 +155,11 @@ class SettingsController extends Controller
|
||||
$departments = $department->get();
|
||||
/* Fetch the values from Timezones table */
|
||||
$timezones = $timezone->get();
|
||||
|
||||
//$debug = \Config::get('app.debug');
|
||||
//dd($value);
|
||||
/* Fetch status value of common settings */
|
||||
$common_setting = $common_settings->select('status')->where('option_name', '=', 'user_set_ticket_status')->first();
|
||||
// /dd($common_setting);
|
||||
/* 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) {
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
@@ -176,16 +177,26 @@ class SettingsController extends Controller
|
||||
public function postsystem($id, System $system, SystemRequest $request)
|
||||
{
|
||||
try {
|
||||
// dd($request);
|
||||
//dd($request->user_set_ticket_status);
|
||||
/* fetch the values of system request */
|
||||
$systems = $system->whereId('1')->first();
|
||||
/* fill the values to coompany table */
|
||||
/* Check whether function success or not */
|
||||
$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);
|
||||
//\Config::set('app.debug', $request->input('debug'));
|
||||
$usts = CommonSettings::where('option_name', '=', 'user_set_ticket_status')->first();
|
||||
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'));
|
||||
} catch (Exception $e) {
|
||||
/* 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 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 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 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 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 Alert $alert
|
||||
|
@@ -221,7 +221,7 @@ class SettingsController2 extends Controller
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/media/company/';
|
||||
$destinationPath = 'uploads/company/';
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
|
@@ -13,6 +13,7 @@ use App\Http\Requests\helpdesk\TemplateUdate;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Utility\Languages;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -326,9 +327,17 @@ class TemplateController extends Controller
|
||||
$mail->SetFrom($email_details->email_address, $email_details->email_name); // sender details
|
||||
$address = $request->to; // receiver email
|
||||
$mail->AddAddress($address);
|
||||
$mail->Subject = utf8_decode($request->subject); // subject of the email
|
||||
$body = utf8_decode($request->message); // body of the email
|
||||
$mail->MsgHTML($body);
|
||||
$mail->Subject = $request->subject; // subject of the email
|
||||
$body = $request->message; // body of the email
|
||||
$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()) {
|
||||
$return = Lang::get('lang.mailer_error').': '.$mail->ErrorInfo;
|
||||
} else {
|
||||
@@ -355,15 +364,22 @@ class TemplateController extends Controller
|
||||
$mail->setFrom($email_details->email_address, $email_details->email_name);
|
||||
$mail->addAddress($request->to, ''); // Add a recipient
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = utf8_decode($request->subject);
|
||||
$mail->Body = utf8_decode($request->message);
|
||||
$mail->CharSet = "utf8";
|
||||
$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()) {
|
||||
$return = Lang::get('lang.mailer_error').': '.$mail->ErrorInfo;
|
||||
} else {
|
||||
$return = Lang::get('lang.message_has_been_sent');
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', $return);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
|
@@ -6,7 +6,7 @@ namespace App\Http\Controllers\Admin\helpdesk;
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Priority;
|
||||
use App\Model\helpdesk\Ticket_thread;
|
||||
use App\Model\helpdesk\Ticket_Thread;
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
@@ -25,7 +25,7 @@ class ThreadController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority)
|
||||
public function getTickets(Ticket_Thread $thread, Priority $priority)
|
||||
{
|
||||
try {
|
||||
/* get the values of Ticket_thread from Ticket_thread Table */
|
||||
|
@@ -132,7 +132,7 @@ class WorkflowController extends Controller
|
||||
->addColumn('Actions', function ($model) {
|
||||
$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();
|
||||
}
|
||||
|
@@ -27,16 +27,15 @@ use PhpImap\Mailbox as ImapMailbox;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class MailController extends Controller
|
||||
{
|
||||
class MailController extends Controller {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param type TicketController $TicketController
|
||||
*/
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController)
|
||||
{
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController) {
|
||||
$this->middleware('board');
|
||||
$this->TicketWorkflowController = $TicketWorkflowController;
|
||||
}
|
||||
@@ -46,13 +45,12 @@ class MailController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket)
|
||||
{
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) {
|
||||
// $path_url = $system->first()->url;
|
||||
if ($settings_email->first()->email_fetching == 1) {
|
||||
if ($settings_email->first()->all_emails == 1) {
|
||||
// $helptopic = $this->TicketController->default_helptopic();
|
||||
// $sla = $this->TicketController->default_sla();
|
||||
// $sla = $this->TicketController->default_sla();
|
||||
$email = $emails->get();
|
||||
foreach ($email as $e_mail) {
|
||||
if ($e_mail->fetching_status == 1) {
|
||||
@@ -82,7 +80,7 @@ class MailController extends Controller
|
||||
$protocol = $fetching_encryption2;
|
||||
} else {
|
||||
if ($e_mail->fetching_protocol) {
|
||||
$fetching_protocol = '/'.$e_mail->fetching_protocol;
|
||||
$fetching_protocol = '/' . $e_mail->fetching_protocol;
|
||||
} else {
|
||||
$fetching_protocol = '';
|
||||
}
|
||||
@@ -91,21 +89,38 @@ class MailController extends Controller
|
||||
} else {
|
||||
$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);
|
||||
try {
|
||||
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
|
||||
} catch (\PhpImap\Exception $e) {
|
||||
echo "Connection error";
|
||||
}
|
||||
$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) {
|
||||
die('Mailbox is empty');
|
||||
}
|
||||
foreach ($mailsIds as $mailId) {
|
||||
try {
|
||||
$overview = $mailbox->get_overview($mailId);
|
||||
} catch (Exception $e) {
|
||||
return \Lang::get('lang.unable_to_fetch_emails');
|
||||
}
|
||||
$var = $overview[0]->seen ? 'read' : 'unread';
|
||||
if ($var == 'unread') {
|
||||
$mail = $mailbox->getMail($mailId);
|
||||
try {
|
||||
$mail = $mailbox->getMail($mailId);
|
||||
} catch (\PhpImap\Exception $e) {
|
||||
echo "Connection error";
|
||||
}
|
||||
if ($settings_email->first()->email_collaborator == 1) {
|
||||
$collaborator = $mail->cc;
|
||||
} else {
|
||||
@@ -121,14 +136,24 @@ class MailController extends Controller
|
||||
}
|
||||
if ($body == null) {
|
||||
$attach = $mail->getAttachments();
|
||||
if (is_array($attach)) {
|
||||
if (key_exists('html-body', $attach)) {
|
||||
$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);
|
||||
//dd($body);
|
||||
}
|
||||
if ($body) {
|
||||
$body = self::trimTableTag($body);
|
||||
} else {
|
||||
$body = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
// if ($body == null) {
|
||||
// $body = $mailbox->backup_getmail($mailId);
|
||||
@@ -137,10 +162,10 @@ class MailController extends Controller
|
||||
$date = $mail->date;
|
||||
$datetime = $overview[0]->date;
|
||||
$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));
|
||||
if (isset($mail->subject)) {
|
||||
$subject = utf8_decode($mail->subject);
|
||||
$subject = $mail->subject;
|
||||
} else {
|
||||
$subject = 'No Subject';
|
||||
}
|
||||
@@ -156,24 +181,23 @@ class MailController extends Controller
|
||||
$team_assign = 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);
|
||||
// dd($result);
|
||||
|
||||
if ($result[1] == true) {
|
||||
$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::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
|
||||
|
||||
$thread_id = $thread_id;
|
||||
foreach ($mail->getAttachments() as $attachment) {
|
||||
$support = 'support';
|
||||
// echo $_SERVER['DOCUMENT_ROOT'];
|
||||
|
||||
$dir_img_paths = __DIR__;
|
||||
$dir_img_path = explode('/code', $dir_img_paths);
|
||||
// dd($attachment->filePath);
|
||||
$filepath = explode('../../../../../public', $attachment->filePath);
|
||||
// var_dump($attachment->filePath);
|
||||
// dd($filepath);
|
||||
// $path = $dir_img_path[0]."/code/public/".$filepath[1];
|
||||
$path = public_path().$filepath[1];
|
||||
// dd($path);
|
||||
|
||||
$filepath = explode('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public', $attachment->filePath);
|
||||
|
||||
if ($filepath[1]) {
|
||||
$path = public_path() . $filepath[1];
|
||||
|
||||
$filesize = filesize($path);
|
||||
$file_data = file_get_contents($path);
|
||||
$ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION);
|
||||
@@ -181,7 +205,7 @@ class MailController extends Controller
|
||||
$string = str_replace('-', '', $attachment->name);
|
||||
$filename = explode('src', $attachment->filePath);
|
||||
$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]);
|
||||
if ($pos == false) {
|
||||
if ($settings_email->first()->attachment == 1) {
|
||||
@@ -206,7 +230,8 @@ class MailController extends Controller
|
||||
}
|
||||
unlink($path);
|
||||
}
|
||||
$body = Encoding::fixUTF8($body);
|
||||
}
|
||||
$body = $body;
|
||||
$thread = Ticket_Thread::where('id', '=', $thread_id)->first();
|
||||
$thread->body = $this->separate_reply($body);
|
||||
$thread->save();
|
||||
@@ -226,8 +251,7 @@ class MailController extends Controller
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function separate_reply($body)
|
||||
{
|
||||
public function separate_reply($body) {
|
||||
$body2 = explode('---Reply above this line---', $body);
|
||||
$body3 = $body2[0];
|
||||
|
||||
@@ -241,8 +265,7 @@ class MailController extends Controller
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function decode_imap_text($str)
|
||||
{
|
||||
public function decode_imap_text($str) {
|
||||
$result = '';
|
||||
$decode_header = imap_mime_header_decode($str);
|
||||
foreach ($decode_header as $obj) {
|
||||
@@ -257,8 +280,7 @@ class MailController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function fetch_attachments()
|
||||
{
|
||||
public function fetch_attachments() {
|
||||
$uploads = Upload::all();
|
||||
foreach ($uploads as $attachment) {
|
||||
$image = @imagecreatefromstring($attachment->file);
|
||||
@@ -266,8 +288,8 @@ class MailController extends Controller
|
||||
imagejpeg($image, null, 80);
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$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>';
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,19 +300,17 @@ class MailController extends Controller
|
||||
*
|
||||
* @return type file
|
||||
*/
|
||||
public function get_data($id)
|
||||
{
|
||||
public function get_data($id) {
|
||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
|
||||
foreach ($attachments as $attachment) {
|
||||
header('Content-type: application/'.$attachment->type.'');
|
||||
header('Content-Disposition: inline; filename='.$attachment->name.'');
|
||||
header('Content-type: application/' . $attachment->type . '');
|
||||
header('Content-Disposition: inline; filename=' . $attachment->name . '');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
echo $attachment->file;
|
||||
}
|
||||
}
|
||||
|
||||
public static function trimTableTag($html)
|
||||
{
|
||||
public static function trimTableTag($html) {
|
||||
if (strpos('<table>', $html) != false) {
|
||||
$first_pos = strpos($html, '<table');
|
||||
$fist_string = substr_replace($html, '', 0, $first_pos);
|
||||
@@ -306,15 +326,13 @@ class MailController extends Controller
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function trim3D($html)
|
||||
{
|
||||
public static function trim3D($html) {
|
||||
$body = str_replace('=3D', '', $html);
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>'])
|
||||
{
|
||||
public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>']) {
|
||||
$replace = [];
|
||||
foreach ($tags as $key => $tag) {
|
||||
$replace[$key] = htmlspecialchars($tag);
|
||||
@@ -323,4 +341,5 @@ class MailController extends Controller
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,18 +22,16 @@ use View;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
class NotificationController extends Controller {
|
||||
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for sending daily report/notification about the system.
|
||||
* */
|
||||
public function send_notification()
|
||||
{
|
||||
public function send_notification() {
|
||||
//fetching email settings
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
// checking if the daily notification is enabled or not
|
||||
@@ -42,6 +40,7 @@ class NotificationController extends Controller
|
||||
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
|
||||
$date = explode(' ', $notification->created_at);
|
||||
if (date('Y-m-d') == $date[0]) {
|
||||
|
||||
} else {
|
||||
// creating a daily notification log
|
||||
Log_notification::create(['log' => 'NOT-1']);
|
||||
@@ -49,11 +48,11 @@ class NotificationController extends Controller
|
||||
// Send notification details to admin
|
||||
$this->send_notification_to_admin($company);
|
||||
// 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
|
||||
$this->send_notification_to_manager($company);
|
||||
//$this->send_notification_to_manager($company);
|
||||
// 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
|
||||
* */
|
||||
public function send_notification_to_admin($company)
|
||||
{
|
||||
public function send_notification_to_admin($company) {
|
||||
// get all admin users
|
||||
$users = User::where('role', '=', 'admin')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to admin
|
||||
$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]);
|
||||
$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]);
|
||||
|
||||
// \Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message) use ($email, $user_name, $company) {
|
||||
// $message->to($email, $user_name)->subject($company.' Daily Report ');
|
||||
// });
|
||||
$from = $this->PhpMailController->mailfrom('1', '0');
|
||||
$to = [
|
||||
'name' => $user_name,
|
||||
'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
|
||||
* */
|
||||
public function send_notification_to_manager($company)
|
||||
{
|
||||
public function send_notification_to_manager($company) {
|
||||
// get all department managers
|
||||
$depts = Department::all();
|
||||
foreach ($depts as $dept) {
|
||||
@@ -99,14 +103,10 @@ class NotificationController extends Controller
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to manager of a department
|
||||
$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]);
|
||||
$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]);
|
||||
|
||||
// \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
|
||||
* */
|
||||
public function send_notification_to_team_lead($company)
|
||||
{
|
||||
public function send_notification_to_team_lead($company) {
|
||||
// get all Team leads
|
||||
$teams = Teams::all();
|
||||
foreach ($teams as $team) {
|
||||
@@ -128,14 +127,10 @@ class NotificationController extends Controller
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to team lead
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name]);
|
||||
$user_name = $user->first_name . ' ' . $user->last_name;
|
||||
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id]);
|
||||
$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]);
|
||||
|
||||
// \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
|
||||
* */
|
||||
public function send_notification_to_agent($company)
|
||||
{
|
||||
public function send_notification_to_agent($company) {
|
||||
// get all agents users
|
||||
$users = User::where('role', '=', 'agent')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to all the agents
|
||||
$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]);
|
||||
$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]);
|
||||
|
||||
// \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
|
||||
*/
|
||||
public function company()
|
||||
{
|
||||
public function company() {
|
||||
// fetching comapny model
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
// fetching company name
|
||||
@@ -183,12 +172,4 @@ class NotificationController extends Controller
|
||||
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');
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ class Ticket2Controller extends Controller
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
SettingsController::smtp();
|
||||
$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)
|
||||
{
|
||||
if (Auth::user()->role == 'admin') {
|
||||
@@ -59,7 +63,6 @@ class Ticket2Controller extends Controller
|
||||
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
|
||||
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
|
||||
}
|
||||
|
||||
return Ttable::getTable($tickets);
|
||||
}
|
||||
|
||||
@@ -82,22 +85,26 @@ class Ticket2Controller extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* this function returns the list of close tickets of a particular department
|
||||
* @param type $id
|
||||
* @return type
|
||||
*/
|
||||
public function getCloseTickets($id)
|
||||
{
|
||||
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 {
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page.
|
||||
*
|
||||
* @return type response
|
||||
* this function returns the list of close tickets of a particular department
|
||||
* @param type $id
|
||||
* @return type
|
||||
*/
|
||||
public function deptinprogress($id)
|
||||
{
|
||||
@@ -129,4 +136,5 @@ class Ticket2Controller extends Controller
|
||||
|
||||
return Ttable::getTable($tickets);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -350,7 +350,6 @@ class TicketWorkflowController extends Controller
|
||||
$ticket_settings_details = $this->changeStatus($workflow_action, $ticket_settings_details);
|
||||
}
|
||||
}
|
||||
|
||||
return $ticket_settings_details;
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// requests
|
||||
/* Include Sys_user Model */
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
@@ -44,8 +45,9 @@ class UserController extends Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -77,7 +79,7 @@ class UserController extends Controller
|
||||
public function user_list()
|
||||
{
|
||||
// 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 */
|
||||
->searchColumns('user_name', 'email', 'phone')
|
||||
/* order column username and email */
|
||||
@@ -179,13 +181,17 @@ class UserController extends Controller
|
||||
/* 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->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->ext = $request->input('ext');
|
||||
$user->phone_number = $request->input('phone_number');
|
||||
$user->country_code = $request->input('country_code');
|
||||
$user->active = $request->input('active');
|
||||
$user->internal_note = $request->input('internal_note');
|
||||
$password = $this->generateRandomString();
|
||||
$user->password = Hash::make($password);
|
||||
$user->role = 'user';
|
||||
try {
|
||||
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();
|
||||
}
|
||||
}
|
||||
$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 */
|
||||
return redirect('user')->with('success', Lang::get('lang.User-Created-Successfully'));
|
||||
} catch (Exception $e) {
|
||||
@@ -260,6 +283,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function update($id, Sys_userUpdate $request)
|
||||
{
|
||||
// dd($request);
|
||||
$user = new User();
|
||||
/* select the field where id = $id(request Id) */
|
||||
$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 ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
@@ -349,7 +373,7 @@ class UserController extends Controller
|
||||
// fetching picture name
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
// fetching upload destination path
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
// adding a random value to profile picture filename
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
// moving the picture to a destination folder
|
||||
@@ -486,4 +510,29 @@ class UserController extends Controller
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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.' '.$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> <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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -63,23 +63,18 @@ class ArticleController extends Controller
|
||||
public function getData()
|
||||
{
|
||||
$article = new Article();
|
||||
$articles = $article
|
||||
->select('id', 'name', 'description', 'publish_time', 'slug')
|
||||
->orderBy('publish_time','desc')
|
||||
->get();
|
||||
// returns chumper datatable
|
||||
return Datatable::query($article)
|
||||
/* searcable column name */
|
||||
->searchColumns('name')
|
||||
/* order column name and description */
|
||||
->orderColumns('name', 'description')
|
||||
return Datatable::Collection($articles)
|
||||
|
||||
/* add column name */
|
||||
->addColumn('name', function ($model) {
|
||||
$string = strip_tags($model->name);
|
||||
if (strlen($string) > 40) {
|
||||
// truncate string
|
||||
$stringCut = substr($string, 0, 40);
|
||||
} else {
|
||||
$stringCut = $model->name;
|
||||
}
|
||||
$name = str_limit($model->name, 20, '...');
|
||||
|
||||
return $stringCut.'...';
|
||||
return "<p title=$model->name>$name</p>";
|
||||
})
|
||||
/* add column Created */
|
||||
->addColumn('publish_time', function ($model) {
|
||||
@@ -90,7 +85,7 @@ class ArticleController extends Controller
|
||||
/* add column action */
|
||||
->addColumn('Actions', function ($model) {
|
||||
/* 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> <a href=article/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <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> <a href='.url("article/$model->id/edit").' class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <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-dialog">
|
||||
<div class="modal-content">
|
||||
@@ -103,12 +98,14 @@ class ArticleController extends Controller
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<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>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>';
|
||||
})
|
||||
->searchColumns('name', 'description', 'publish_time')
|
||||
->orderColumns('name', 'description', 'publish_time')
|
||||
->make();
|
||||
}
|
||||
|
||||
@@ -253,9 +250,9 @@ class ArticleController extends Controller
|
||||
$article->publish_time = $publishTime;
|
||||
$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) {
|
||||
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->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
|
||||
return Redirect::back()->with('fails', Lang::get('lang.article_not_deleted'));
|
||||
return redirect('article')->with('fails', Lang::get('lang.article_not_deleted'));
|
||||
}
|
||||
} 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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -77,14 +77,7 @@ class CategoryController extends Controller
|
||||
/* add column name */
|
||||
->addColumn('name', function ($model) {
|
||||
$string = strip_tags($model->name);
|
||||
if (strlen($string) > 40) {
|
||||
// truncate string
|
||||
$stringCut = substr($string, 0, 40);
|
||||
} else {
|
||||
$stringCut = $model->name;
|
||||
}
|
||||
|
||||
return $stringCut.'...';
|
||||
return str_limit($string, 20);
|
||||
})
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
@@ -127,7 +120,7 @@ class CategoryController extends Controller
|
||||
public function create(Category $category)
|
||||
{
|
||||
/* 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
|
||||
of category model */
|
||||
try {
|
||||
@@ -148,13 +141,12 @@ class CategoryController extends Controller
|
||||
public function store(Category $category, CategoryRequest $request)
|
||||
{
|
||||
/* 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, '-');
|
||||
$category->slug = $slug;
|
||||
// send success message to index page
|
||||
try {
|
||||
$category->fill($request->except('slug'))->save();
|
||||
|
||||
$category->fill($request->input())->save();
|
||||
return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully'));
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>');
|
||||
@@ -169,15 +161,13 @@ class CategoryController extends Controller
|
||||
*
|
||||
* @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 */
|
||||
$category = Category::whereId($id)->first();
|
||||
$categories = Category::lists('name','id')->toArray();
|
||||
/* 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
|
||||
*/
|
||||
public function update($slug, CategoryUpdate $request)
|
||||
public function update($id, CategoryRequest $request)
|
||||
{
|
||||
|
||||
/* Edit the selected category via id */
|
||||
$category = Category::where('id', $slug)->first();
|
||||
$sl = $request->input('slug');
|
||||
$category = Category::where('id', $id)->first();
|
||||
$sl = $request->input('name');
|
||||
$slug = str_slug($sl, '-');
|
||||
// dd($slug);
|
||||
$category->slug = $slug;
|
||||
/* update the values at the table via model according with the request */
|
||||
//redirct to index page with success message
|
||||
try {
|
||||
$category->fill($request->all())->save();
|
||||
$category->slug = $slug;
|
||||
$category->save();
|
||||
|
||||
$category->fill($request->input())->save();
|
||||
return redirect('category')->with('success', Lang::get('lang.category_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
//redirect to index with fails message
|
||||
|
@@ -125,11 +125,11 @@ class PageController extends Controller
|
||||
*/
|
||||
public function store(PageRequest $request)
|
||||
{
|
||||
$sl = $request->input('slug');
|
||||
$sl = $request->input('name');
|
||||
$slug = str_slug($sl, '-');
|
||||
$this->page->slug = $slug;
|
||||
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'));
|
||||
} catch (Exception $e) {
|
||||
@@ -163,13 +163,12 @@ class PageController extends Controller
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function update($slug, PageUpdate $request)
|
||||
public function update($slug, PageRequest $request)
|
||||
{
|
||||
// get pages with respect to slug
|
||||
$pages = $this->page->where('slug', $slug)->first();
|
||||
$sl = $request->input('slug');
|
||||
$sl = $request->input('name');
|
||||
$slug = str_slug($sl, '-');
|
||||
$this->page->slug = $slug;
|
||||
try {
|
||||
$pages->fill($request->all())->save();
|
||||
$pages->slug = $slug;
|
||||
|
Binary file not shown.
@@ -33,8 +33,8 @@ use Illuminate\Support\Collection;
|
||||
*
|
||||
* @version v1
|
||||
*/
|
||||
class ApiController extends Controller
|
||||
{
|
||||
class ApiController extends Controller {
|
||||
|
||||
public $user;
|
||||
public $request;
|
||||
public $ticket;
|
||||
@@ -54,8 +54,7 @@ class ApiController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
public function __construct(Request $request) {
|
||||
$this->request = $request;
|
||||
|
||||
$this->middleware('jwt.auth');
|
||||
@@ -64,7 +63,9 @@ class ApiController extends Controller
|
||||
$user = \JWTAuth::parseToken()->authenticate();
|
||||
$this->user = $user;
|
||||
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
|
||||
|
||||
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
|
||||
|
||||
}
|
||||
|
||||
$ticket = new TicketController();
|
||||
@@ -119,8 +120,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function createTicket()
|
||||
{
|
||||
public function createTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -189,8 +189,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketReply()
|
||||
{
|
||||
public function ticketReply() {
|
||||
//dd($this->request->all());
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
@@ -224,8 +223,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function editTicket()
|
||||
{
|
||||
public function editTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -262,8 +260,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function deleteTicket()
|
||||
{
|
||||
public function deleteTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -296,8 +293,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function openedTickets()
|
||||
{
|
||||
public function openedTickets() {
|
||||
try {
|
||||
// $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
@@ -341,8 +337,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function unassignedTickets()
|
||||
{
|
||||
public function unassignedTickets() {
|
||||
try {
|
||||
//dd('sdhjbc');
|
||||
// $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
|
||||
@@ -360,8 +355,8 @@ class ApiController extends Controller
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->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')
|
||||
->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')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
@@ -386,15 +381,14 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function closeTickets()
|
||||
{
|
||||
public function closeTickets() {
|
||||
try {
|
||||
// $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
|
||||
$result = $this->user->join('tickets', function ($join) {
|
||||
$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('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
@@ -405,8 +399,8 @@ class ApiController extends Controller
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->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')
|
||||
->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')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
@@ -431,8 +425,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getAgents()
|
||||
{
|
||||
public function getAgents() {
|
||||
try {
|
||||
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
|
||||
|
||||
@@ -455,8 +448,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getTeams()
|
||||
{
|
||||
public function getTeams() {
|
||||
try {
|
||||
$result = $this->team->get();
|
||||
|
||||
@@ -479,8 +471,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function assignTicket()
|
||||
{
|
||||
public function assignTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required',
|
||||
@@ -518,8 +509,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomers()
|
||||
{
|
||||
public function getCustomers() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
@@ -530,7 +520,7 @@ class ApiController extends Controller
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$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'))
|
||||
->header('X-Header-One', 'Header Value');
|
||||
@@ -544,7 +534,6 @@ class ApiController extends Controller
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'))
|
||||
|
||||
->header('X-Header-One', 'Header Value');
|
||||
}
|
||||
}
|
||||
@@ -554,8 +543,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomersWith()
|
||||
{
|
||||
public function getCustomersWith() {
|
||||
try {
|
||||
$users = $this->user
|
||||
->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id')
|
||||
@@ -586,8 +574,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
public function getCustomer() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required',
|
||||
@@ -619,8 +606,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function searchTicket()
|
||||
{
|
||||
public function searchTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
@@ -631,7 +617,7 @@ class ApiController extends Controller
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$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'));
|
||||
} catch (Exception $e) {
|
||||
@@ -652,8 +638,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketThreads()
|
||||
{
|
||||
public function ticketThreads() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'id' => 'required',
|
||||
@@ -690,8 +675,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function checkUrl()
|
||||
{
|
||||
public function checkUrl() {
|
||||
//dd($this->request);
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
@@ -708,7 +692,7 @@ class ApiController extends Controller
|
||||
$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);
|
||||
//dd($result);
|
||||
return response()->json(compact('result'));
|
||||
@@ -728,8 +712,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function urlResult()
|
||||
{
|
||||
public function urlResult() {
|
||||
return 'success';
|
||||
}
|
||||
|
||||
@@ -740,8 +723,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callGetApi($url)
|
||||
{
|
||||
public function callGetApi($url) {
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
@@ -750,7 +732,7 @@ class ApiController extends Controller
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:'.curl_error($curl);
|
||||
echo 'error:' . curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
@@ -765,8 +747,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callPostApi($url, $data)
|
||||
{
|
||||
public function callPostApi($url, $data) {
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
@@ -776,7 +757,7 @@ class ApiController extends Controller
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:'.curl_error($curl);
|
||||
echo 'error:' . curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
@@ -788,8 +769,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return type | json
|
||||
*/
|
||||
public function generateApiKey()
|
||||
{
|
||||
public function generateApiKey() {
|
||||
try {
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
//dd($set);
|
||||
@@ -823,8 +803,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getHelpTopic()
|
||||
{
|
||||
public function getHelpTopic() {
|
||||
try {
|
||||
$result = $this->helptopic->get();
|
||||
|
||||
@@ -847,8 +826,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getSlaPlan()
|
||||
{
|
||||
public function getSlaPlan() {
|
||||
try {
|
||||
$result = $this->slaPlan->get();
|
||||
|
||||
@@ -871,8 +849,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getPriority()
|
||||
{
|
||||
public function getPriority() {
|
||||
try {
|
||||
$result = $this->priority->get();
|
||||
|
||||
@@ -895,8 +872,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
public function getDepartment() {
|
||||
try {
|
||||
$result = $this->department->get();
|
||||
|
||||
@@ -919,8 +895,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function getTickets()
|
||||
{
|
||||
public function getTickets() {
|
||||
try {
|
||||
$tickets = $this->model->orderBy('created_at', 'desc')->paginate(10);
|
||||
$tickets->toJson();
|
||||
@@ -944,10 +919,13 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function inbox()
|
||||
{
|
||||
public function inbox() {
|
||||
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('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->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_thread', function ($join) {
|
||||
$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')
|
||||
->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', 'ticket_thread.title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
@@ -983,8 +961,7 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function internalNote()
|
||||
{
|
||||
public function internalNote() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'userid' => 'required|exists:users,id',
|
||||
@@ -1016,8 +993,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getTrash()
|
||||
{
|
||||
public function getTrash() {
|
||||
try {
|
||||
$trash = $this->user->join('tickets', function ($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
@@ -1032,8 +1008,8 @@ class ApiController extends Controller
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->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')
|
||||
->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')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
@@ -1053,8 +1029,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getMyTicketsAgent()
|
||||
{
|
||||
public function getMyTicketsAgent() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -1072,7 +1047,8 @@ class ApiController extends Controller
|
||||
}
|
||||
$result = $this->user->join('tickets', function ($join) use ($id) {
|
||||
$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('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
@@ -1083,8 +1059,9 @@ class ApiController extends Controller
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->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')
|
||||
->orderBy('ticket_thread.updated_at', 'desc')
|
||||
->where('users.id',$id)
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
@@ -1104,8 +1081,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getMyTicketsUser()
|
||||
{
|
||||
public function getMyTicketsUser() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -1156,8 +1132,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getTicketById()
|
||||
{
|
||||
public function getTicketById() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'id' => 'required|exists:tickets,id',
|
||||
@@ -1169,11 +1144,18 @@ class ApiController extends Controller
|
||||
}
|
||||
$id = $this->request->input('id');
|
||||
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'));
|
||||
}
|
||||
$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'));
|
||||
} catch (\Exception $e) {
|
||||
@@ -1189,8 +1171,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function createPagination($array, $perPage)
|
||||
{
|
||||
public function createPagination($array, $perPage) {
|
||||
try {
|
||||
//Get current page form url e.g. &page=6
|
||||
$currentPage = LengthAwarePaginator::resolveCurrentPage();
|
||||
@@ -1218,8 +1199,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function collaboratorSearch()
|
||||
{
|
||||
public function collaboratorSearch() {
|
||||
$this->validate($this->request, ['term' => 'required']);
|
||||
try {
|
||||
$emails = $this->ticket->autosearch();
|
||||
@@ -1229,7 +1209,7 @@ class ApiController extends Controller
|
||||
foreach ($emails as $key => $email) {
|
||||
$user_model = $user->where('email', $email)->first();
|
||||
//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]['avatar'] = $this->avatarUrl($email);
|
||||
}
|
||||
@@ -1246,13 +1226,12 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function avatarUrl($email)
|
||||
{
|
||||
public function avatarUrl($email) {
|
||||
try {
|
||||
$user = new User();
|
||||
$user = $user->where('email', $email)->first();
|
||||
if ($user->profile_pic) {
|
||||
$url = url('lb-faveo/media/profilepic/'.$user->profile_pic);
|
||||
$url = url('uploads/profilepic/' . $user->profile_pic);
|
||||
} else {
|
||||
$url = \Gravatar::src($email);
|
||||
}
|
||||
@@ -1264,8 +1243,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function addCollaboratorForTicket()
|
||||
{
|
||||
public function addCollaboratorForTicket() {
|
||||
try {
|
||||
$v = \Validator::make(\Input::get(), [
|
||||
'email' => 'required|email|unique:users',
|
||||
@@ -1295,8 +1273,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getCollaboratorForTicket()
|
||||
{
|
||||
public function getCollaboratorForTicket() {
|
||||
try {
|
||||
$v = \Validator::make(\Input::get(), [
|
||||
'ticket_id' => 'required',
|
||||
@@ -1325,8 +1302,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCollaborator()
|
||||
{
|
||||
public function deleteCollaborator() {
|
||||
try {
|
||||
$v = \Validator::make(\Input::get(), [
|
||||
'ticketid' => 'required',
|
||||
@@ -1350,8 +1326,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function dependency()
|
||||
{
|
||||
public function dependency() {
|
||||
try {
|
||||
$department = $this->department->select('name', 'id')->get()->toArray();
|
||||
$sla = $this->slaPlan->select('name', 'id')->get()->toArray();
|
||||
@@ -1362,7 +1337,7 @@ class ApiController extends Controller
|
||||
$status = \DB::table('ticket_status')->select('name', 'id')->get();
|
||||
$source = \DB::table('ticket_source')->select('name', 'id')->get();
|
||||
$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'));
|
||||
} catch (\Exception $e) {
|
||||
@@ -1373,4 +1348,73 @@ class ApiController extends Controller
|
||||
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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
105
app/Http/Controllers/Api/v1/PushNotificationController.php
Normal file
105
app/Http/Controllers/Api/v1/PushNotificationController.php
Normal 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'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -422,6 +422,7 @@ class TicketController extends Controller
|
||||
$ticket->help_topic_id = Input::get('help_topic');
|
||||
$ticket->source = Input::get('ticket_source');
|
||||
$ticket->priority_id = Input::get('ticket_priority');
|
||||
$ticket->status = Input::get('status');
|
||||
$ticket->save();
|
||||
|
||||
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
||||
@@ -724,7 +725,7 @@ class TicketController extends Controller
|
||||
$user = new User();
|
||||
$user = $user->where('email', $email)->first();
|
||||
if ($user->profile_pic) {
|
||||
$url = url('lb-faveo/media/profilepic/'.$user->profile_pic);
|
||||
$url = url('uploads/profilepic/'.$user->profile_pic);
|
||||
} else {
|
||||
$url = \Gravatar::src($email);
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ class TokenAuthController extends Controller
|
||||
//$credentials = $request->only('email', 'password');
|
||||
|
||||
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]);
|
||||
}
|
||||
} catch (JWTException $e) {
|
||||
@@ -100,30 +100,30 @@ class TokenAuthController extends Controller
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$newuser = $request->all();
|
||||
$password = Hash::make($request->input('password'));
|
||||
|
||||
$newuser['password'] = $password;
|
||||
|
||||
return User::create($newuser);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
// public function register(Request $request)
|
||||
// {
|
||||
// try {
|
||||
// $v = \Validator::make($request->all(), [
|
||||
// 'email' => 'required|email|unique:users',
|
||||
// 'password' => 'required',
|
||||
// ]);
|
||||
// if ($v->fails()) {
|
||||
// $error = $v->errors();
|
||||
//
|
||||
// return response()->json(compact('error'));
|
||||
// }
|
||||
// $newuser = $request->all();
|
||||
// $password = Hash::make($request->input('password'));
|
||||
//
|
||||
// $newuser['password'] = $password;
|
||||
//
|
||||
// return User::create($newuser);
|
||||
// } catch (\Exception $e) {
|
||||
// $error = $e->getMessage();
|
||||
//
|
||||
// return response()->json(compact('error'));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* verify the url is existing or not.
|
||||
|
@@ -53,7 +53,6 @@ class AuthController extends Controller
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->middleware('guest', ['except' => 'getLogout']);
|
||||
}
|
||||
|
||||
@@ -186,6 +185,7 @@ class AuthController extends Controller
|
||||
*/
|
||||
public function postLogin(LoginRequest $request)
|
||||
{
|
||||
\Event::fire('auth.login.event', []); //added 5/5/2016
|
||||
// Set login attempts and login time
|
||||
$value = $_SERVER['REMOTE_ADDR'];
|
||||
$usernameinput = $request->input('email');
|
||||
@@ -227,10 +227,10 @@ class AuthController extends Controller
|
||||
$password = $request->input('password');
|
||||
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
||||
// 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() - $loginAttemptTime > ($security->lockout_period * 60)) {
|
||||
\Session::put('loginAttempts', 1);
|
||||
@@ -243,7 +243,7 @@ class AuthController extends Controller
|
||||
}
|
||||
// If auth ok, redirect to restricted area
|
||||
\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::user()->role == 'user') {
|
||||
return \Redirect::route('/');
|
||||
@@ -277,13 +277,15 @@ class AuthController extends Controller
|
||||
if ($data) {
|
||||
$attempts = $data->Attempts + 1;
|
||||
if ($attempts == $apt) {
|
||||
$result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'");
|
||||
// $result = DB::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 {
|
||||
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]);
|
||||
// $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'");
|
||||
}
|
||||
} else {
|
||||
$result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())");
|
||||
// $result = DB::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;
|
||||
} else {
|
||||
$this->clearLoginAttempts($value, $field);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ class PasswordController extends Controller
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
$this->middleware('guest');
|
||||
SettingsController::smtp();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +53,7 @@ class PasswordController extends Controller
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
\Event::fire('reset.password',array());
|
||||
$user = User::where('email', '=', $request->only('email'))->first();
|
||||
if (isset($user)) {
|
||||
$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'));
|
||||
} 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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -327,18 +327,18 @@ class UserController extends Controller
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
|
@@ -33,16 +33,15 @@ use Redirect;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller
|
||||
{
|
||||
class FormController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Constructor to check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController)
|
||||
{
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController) {
|
||||
$this->middleware('board');
|
||||
// creating a TicketController instance
|
||||
$this->TicketWorkflowController = $TicketWorkflowController;
|
||||
@@ -55,18 +54,21 @@ class FormController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic, CountryCode $code)
|
||||
{
|
||||
public function getForm(Help_topic $topic, CountryCode $code) {
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
return \Redirect::route('licence');
|
||||
}
|
||||
$location = GeoIP::getLocation('');
|
||||
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
$codes = $code->get();
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode->phonecode);
|
||||
if ($phonecode->phonecode) {
|
||||
$phonecode = $phonecode->phonecode;
|
||||
} else {
|
||||
$phonecode = "";
|
||||
}
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
@@ -80,46 +82,46 @@ class FormController extends Controller
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id, Help_topic $topic)
|
||||
{
|
||||
public function postForm($id, Help_topic $topic) {
|
||||
if ($id != 0) {
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if (!$values) {
|
||||
|
||||
}
|
||||
if ($values) {
|
||||
foreach ($values as $value) {
|
||||
if ($value->type == 'select') {
|
||||
$data = $value->value;
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
foreach ($value as $option) {
|
||||
echo '<option>'.$option.'</option>';
|
||||
foreach ($values as $form_data) {
|
||||
if ($form_data->type == "select") {
|
||||
$form_fields = explode(',', $form_data->value);
|
||||
$var = "";
|
||||
foreach ($form_fields as $form_field) {
|
||||
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>';
|
||||
}
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>';
|
||||
} elseif ($form_data->type == "radio") {
|
||||
$type2 = $form_data->value;
|
||||
$vals = explode(',', $type2);
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
|
||||
foreach ($vals as $val) {
|
||||
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $val . ' ';
|
||||
}
|
||||
echo "<br/>";
|
||||
} elseif ($form_data->type == "textarea") {
|
||||
$type3 = $form_data->value;
|
||||
echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>';
|
||||
} elseif ($form_data->type == "checkbox") {
|
||||
$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 . '">  ' . $check;
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == 'radio') {
|
||||
$type2 = $value->value;
|
||||
$val = explode(',', $type2);
|
||||
echo '<label class="radio-inline">'.$value->label.'</label>   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[0].'
|
||||
   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[1].'</br>';
|
||||
} elseif ($value->type == 'textarea') {
|
||||
$type3 = $value->value;
|
||||
$v = explode(',', $type3);
|
||||
//dd($v);
|
||||
if (array_key_exists(1, $v)) {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
}
|
||||
} elseif ($value->type == 'checkbox') {
|
||||
$type4 = $value->value;
|
||||
$check = explode(',', $type4);
|
||||
echo '<label class="radio-inline">'.$value->label.'   <input type="'.$value->type.'" name="'.$value->name.'">  '.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">  '.$check[1].'</label></br>';
|
||||
} 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 {
|
||||
return;
|
||||
@@ -132,8 +134,7 @@ class FormController extends Controller
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code)
|
||||
{
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) {
|
||||
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
|
||||
|
||||
$name = $request->input('Name');
|
||||
@@ -142,12 +143,16 @@ class FormController extends Controller
|
||||
$subject = $request->input('Subject');
|
||||
$details = $request->input('Details');
|
||||
$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');
|
||||
$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;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
$source = $ticket_source->where('name', '=', 'web')->first()->id;
|
||||
@@ -197,9 +202,10 @@ class FormController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request)
|
||||
{
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
try {
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$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');
|
||||
|
||||
$user_cred = User::where('id', '=', $tickets->user_id)->first();
|
||||
@@ -248,29 +253,24 @@ class FormController extends Controller
|
||||
} catch (Exception $e) {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@@ -16,6 +16,7 @@ use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Utility\CountryCode;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\User;
|
||||
use Auth;
|
||||
// classes
|
||||
@@ -76,18 +77,18 @@ class GuestController extends Controller
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$destinationPath = 'uploads/profilepic';
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
@@ -138,7 +139,7 @@ class GuestController extends Controller
|
||||
public function getForm(Help_topic $topic)
|
||||
{
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
return \Redirect::route('licence');
|
||||
}
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
@@ -316,11 +317,13 @@ class GuestController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function get_ticket_email($id)
|
||||
public function get_ticket_email($id, CommonSettings $common_settings)
|
||||
{
|
||||
$id1 = \Crypt::decrypt($id);
|
||||
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('id'));
|
||||
$common_setting = $common_settings->select('status')
|
||||
->where('option_name', '=', 'user_set_ticket_status')
|
||||
->first();
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('id', 'common_setting'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,18 +24,10 @@ use Lang;
|
||||
use Mail;
|
||||
use Redirect;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
class UserController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('board');
|
||||
//$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
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings)
|
||||
{
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
if (Auth::check()) {
|
||||
if (\Auth::user()->role == 'user') {
|
||||
$article = $article->where('status', '1');
|
||||
}
|
||||
} else {
|
||||
public function getArticle(Article $article, Category $category, Settings $settings) {
|
||||
$setting = $settings->first();
|
||||
$pagination = $setting->pagination;
|
||||
if (\Auth::user()->role == 'user' || !Auth::check()) {
|
||||
$article = $article->where('status', '1');
|
||||
}
|
||||
$article = $article->where('type', '1');
|
||||
$article = $article->paginate($pagination);
|
||||
// dd($article);
|
||||
$article->setPath('article-list');
|
||||
$categorys = $category->get();
|
||||
// $time = $this->timezone($utc);
|
||||
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
|
||||
}
|
||||
|
||||
@@ -72,8 +57,7 @@ class UserController extends Controller
|
||||
*
|
||||
* @return string excerpt
|
||||
*/
|
||||
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
|
||||
{
|
||||
public static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
|
||||
if (strlen($str) > $maxLength) {
|
||||
$excerpt = substr($str, $startPos, $maxLength - 3);
|
||||
$lastSpace = strrpos($excerpt, ' ');
|
||||
@@ -96,14 +80,13 @@ class UserController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
|
||||
{
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) {
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
$search = $request->input('s');
|
||||
$result = $article->where('name', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('slug', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('description', 'LIKE', '%'.$search.'%')
|
||||
$result = $article->where('name', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('slug', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('description', 'LIKE', '%' . $search . '%')
|
||||
->paginate($pagination);
|
||||
$result->setPath('search');
|
||||
$categorys = $category->get();
|
||||
@@ -116,34 +99,31 @@ class UserController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function show($slug, Article $article, Category $category)
|
||||
{
|
||||
public function show($slug, Article $article, Category $category) {
|
||||
//ArticleController::timezone();
|
||||
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
|
||||
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
|
||||
date_default_timezone_set($tz);
|
||||
$date = \Carbon\Carbon::now()->toDateTimeString();
|
||||
$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('type', '1');
|
||||
$arti = $arti->where('publish_time', '<', $date);
|
||||
}
|
||||
|
||||
$arti = $arti->where('type', '1');
|
||||
|
||||
$arti = $arti->first();
|
||||
|
||||
if ($arti) {
|
||||
return view('themes.default1.client.kb.article-list.show', compact('arti'));
|
||||
} 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 */
|
||||
$catid = $category->where('slug', $slug)->first();
|
||||
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'));
|
||||
}
|
||||
|
||||
public function home(Article $article, Category $category, Relationship $relation)
|
||||
{
|
||||
public function home(Article $article, Category $category, Relationship $relation) {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return redirect('step1');
|
||||
} else {
|
||||
@@ -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();
|
||||
$categorys = $category->get();
|
||||
|
||||
@@ -185,8 +163,7 @@ class UserController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function contact(Category $category, Settings $settings)
|
||||
{
|
||||
public function contact(Category $category, Settings $settings) {
|
||||
$settings = $settings->whereId('1')->first();
|
||||
$categorys = $category->get();
|
||||
|
||||
@@ -198,8 +175,7 @@ class UserController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function postContact(ContactRequest $request, Contact $contact)
|
||||
{
|
||||
public function postContact(ContactRequest $request, Contact $contact) {
|
||||
$this->port();
|
||||
$this->host();
|
||||
$this->encryption();
|
||||
@@ -226,8 +202,7 @@ class UserController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function contactDetails()
|
||||
{
|
||||
public function contactDetails() {
|
||||
return view('themes.default1.client.kb.article-list.contact-details');
|
||||
}
|
||||
|
||||
@@ -241,9 +216,11 @@ class UserController extends Controller
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
|
||||
{
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
|
||||
$article = $article->where('slug', $slug)->first();
|
||||
if(!$article){
|
||||
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
|
||||
}
|
||||
$id = $article->id;
|
||||
$comment->article_id = $id;
|
||||
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();
|
||||
//$this->timezone($page->created_at);
|
||||
if($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();
|
||||
Config::set('mail.port', $setting->port);
|
||||
}
|
||||
|
||||
public static function host()
|
||||
{
|
||||
public static function host() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.host', $setting->host);
|
||||
}
|
||||
|
||||
public static function encryption()
|
||||
{
|
||||
public static function encryption() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
|
||||
}
|
||||
|
||||
public static function email()
|
||||
{
|
||||
public static function email() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
|
||||
//dd(Config::get('mail'));
|
||||
}
|
||||
|
||||
public static function password()
|
||||
{
|
||||
public static function password() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
|
||||
}
|
||||
|
||||
public function getCategoryList(Article $article, Category $category, Relationship $relation)
|
||||
{
|
||||
public function getCategoryList(Article $article, Category $category, Relationship $relation) {
|
||||
//$categorys = $category->get();
|
||||
$categorys = $category->get();
|
||||
// $categorys->setPath('home');
|
||||
@@ -314,15 +287,13 @@ class UserController extends Controller
|
||||
// //return substr($date, 0, -6);
|
||||
// }
|
||||
|
||||
public function clientProfile()
|
||||
{
|
||||
public function clientProfile() {
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.client.kb.article-list.profile', compact('user'));
|
||||
}
|
||||
|
||||
public function postClientProfile($id, ProfileRequest $request)
|
||||
{
|
||||
public function postClientProfile($id, ProfileRequest $request) {
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -341,7 +312,7 @@ class UserController extends Controller
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $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();
|
||||
//echo $user->password;
|
||||
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'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
49
app/Http/Controllers/Common/FileuploadController.php
Normal file
49
app/Http/Controllers/Common/FileuploadController.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -5,84 +5,110 @@ namespace App\Http\Controllers\Common;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Notification\Notification;
|
||||
use App\Model\helpdesk\Notification\UserNotification;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
use App\Http\Controllers\Api\v1\PushNotificationController;
|
||||
use App\Model\helpdesk\Notification\NotificationType;
|
||||
|
||||
class NotificationController extends Controller {
|
||||
/**
|
||||
*********************************************
|
||||
* Class 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>
|
||||
*/
|
||||
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
public $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(PushNotificationController $PushNotificationController) {
|
||||
$this->PushNotificationController = $PushNotificationController;
|
||||
$user = new 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.
|
||||
*
|
||||
* @return response
|
||||
* This function is used to create in app notifications.
|
||||
* @param type $model_id
|
||||
* @param type $userid_created
|
||||
* @param type $type_id
|
||||
* @param type $forwhome
|
||||
*/
|
||||
public 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;
|
||||
}
|
||||
|
||||
public function create($model_id, $userid_created, $type_id, $forwhome = [])
|
||||
{
|
||||
public function create($model_id, $userid_created, $type_id, $forwhome = []) {
|
||||
try {
|
||||
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
|
||||
$notification = new Notification();
|
||||
$UN = new UserNotification();
|
||||
|
||||
$notify = $notification->create(['model_id' => $model_id, 'userid_created' => $userid_created, 'type_id' => $type_id]);
|
||||
// system notification
|
||||
$notify = Notification::create(['model_id' => $model_id, 'userid_created' => $userid_created, 'type_id' => $type_id]);
|
||||
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) {
|
||||
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();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->is_read = '1';
|
||||
$mark->save();
|
||||
}
|
||||
|
||||
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();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->is_read = '1';
|
||||
$mark->save();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
/**
|
||||
* function to show all the notifications
|
||||
* @return type
|
||||
*/
|
||||
public function show() {
|
||||
$notifications = $this->getNotifications();
|
||||
|
||||
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();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->delete();
|
||||
@@ -90,4 +116,17 @@ class NotificationController extends Controller
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,15 +8,14 @@ use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\User;
|
||||
use Auth;
|
||||
|
||||
class PhpMailController extends Controller
|
||||
{
|
||||
public function fetch_smtp_details($id)
|
||||
{
|
||||
$emails = Emails::where('id', '=', $id)->first();
|
||||
class PhpMailController extends Controller {
|
||||
|
||||
public function fetch_smtp_details($id) {
|
||||
$emails = Emails::where('id', '=', $id)->first();
|
||||
return $emails;
|
||||
}
|
||||
|
||||
@@ -25,8 +24,8 @@ class PhpMailController extends Controller
|
||||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function sendmail($from, $to, $message, $template_variables)
|
||||
{
|
||||
public function sendmail($from, $to, $message, $template_variables) {
|
||||
// try {
|
||||
// dd($from);
|
||||
$from_address = $this->fetch_smtp_details($from);
|
||||
if ($from_address == null) {
|
||||
@@ -61,11 +60,11 @@ class PhpMailController extends Controller
|
||||
} else {
|
||||
$bc = null;
|
||||
}
|
||||
// if (isset($message['subject'])) {
|
||||
// $subject = $message['subject'];
|
||||
// } else {
|
||||
// $subject = null;
|
||||
// }
|
||||
// if (isset($message['subject'])) {
|
||||
// $subject = $message['subject'];
|
||||
// } else {
|
||||
// $subject = null;
|
||||
// }
|
||||
if (isset($message['body'])) {
|
||||
$content = $message['body'];
|
||||
} else {
|
||||
@@ -123,15 +122,15 @@ class PhpMailController extends Controller
|
||||
} else {
|
||||
$ticket_link_with_number = null;
|
||||
}
|
||||
// if (isset($template_variables['system_from'])) {
|
||||
// $system_from = $template_variables['system_from'];
|
||||
// } else {
|
||||
// $system_from = null;
|
||||
// }
|
||||
if (isset($template_variables['system_from'])) {
|
||||
$system_from = $template_variables['system_from'];
|
||||
} else {
|
||||
$system_from = $this->company();
|
||||
}
|
||||
if (isset($template_variables['system_link'])) {
|
||||
$system_link = $template_variables['system_link'];
|
||||
} else {
|
||||
$system_link = null;
|
||||
$system_link = url('/');
|
||||
}
|
||||
if (isset($template_variables['system_error'])) {
|
||||
$system_error = $template_variables['system_error'];
|
||||
@@ -169,9 +168,9 @@ class PhpMailController extends Controller
|
||||
$user = null;
|
||||
}
|
||||
|
||||
$system_link = url('/');
|
||||
// $system_link = url('/');
|
||||
|
||||
$system_from = $this->company();
|
||||
// $system_from = $this->company();
|
||||
|
||||
$mail = new \PHPMailer();
|
||||
|
||||
@@ -179,11 +178,11 @@ class PhpMailController extends Controller
|
||||
|
||||
$path2 = \Config::get('view.paths');
|
||||
|
||||
// $directory = $path2[0].DIRECTORY_SEPARATOR.'emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
|
||||
//
|
||||
// $handle = fopen($directory.$template.'.blade.php', 'r');
|
||||
// $contents = fread($handle, filesize($directory.$template.'.blade.php'));
|
||||
// fclose($handle);
|
||||
// $directory = $path2[0].DIRECTORY_SEPARATOR.'emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
|
||||
//
|
||||
// $handle = fopen($directory.$template.'.blade.php', 'r');
|
||||
// $contents = fread($handle, filesize($directory.$template.'.blade.php'));
|
||||
// fclose($handle);
|
||||
|
||||
$template = TemplateType::where('name', '=', $template)->first();
|
||||
|
||||
@@ -196,7 +195,7 @@ class PhpMailController extends Controller
|
||||
if ($template_data->subject) {
|
||||
$subject = $template_data->subject;
|
||||
if ($ticket_number != null) {
|
||||
$subject = $subject.' [#'.$ticket_number.']';
|
||||
$subject = $subject . ' [#' . $ticket_number . ']';
|
||||
}
|
||||
} else {
|
||||
$subject = $message['subject'];
|
||||
@@ -243,9 +242,6 @@ class PhpMailController extends Controller
|
||||
}
|
||||
}
|
||||
$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) {
|
||||
@@ -257,8 +253,6 @@ class PhpMailController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// $mail->addBCC($bc);
|
||||
|
||||
if ($attachment != null) {
|
||||
$size = count($message['attachments']);
|
||||
$attach = $message['attachments'];
|
||||
@@ -268,24 +262,26 @@ class PhpMailController extends Controller
|
||||
$mail->addAttachment($file_path, $file_name);
|
||||
}
|
||||
}
|
||||
|
||||
$mail->Subject = utf8_decode($subject);
|
||||
$mail->CharSet = "utf8";
|
||||
$mail->Subject = $subject;
|
||||
if ($template == 'ticket-reply-agent') {
|
||||
$line = '---Reply above this line--- <br/><br/>';
|
||||
$mail->Body = utf8_decode($line.$messagebody);
|
||||
$body = $line . $messagebody;
|
||||
} else {
|
||||
$mail->Body = utf8_decode($messagebody);
|
||||
$body = $messagebody;
|
||||
}
|
||||
|
||||
// $mail->AltBody = $altbody;
|
||||
$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;
|
||||
// echo 'Message could not be sent.';
|
||||
// echo 'Mailer Error: '.$mail->ErrorInfo;
|
||||
} else {
|
||||
return 1;
|
||||
// echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,16 +291,19 @@ class PhpMailController extends Controller
|
||||
*
|
||||
* @return MailNotification
|
||||
*/
|
||||
public function sendEmail($from, $to, $message)
|
||||
{
|
||||
public function sendEmail($from, $to, $message) {
|
||||
try {
|
||||
$from_address = $this->fetch_smtp_details($from);
|
||||
|
||||
if ($from_address == null) {
|
||||
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;
|
||||
|
||||
if (isset($to['email'])) {
|
||||
$recipants = $to['email'];
|
||||
@@ -364,7 +363,7 @@ class PhpMailController extends Controller
|
||||
|
||||
// dd($messagebody);
|
||||
//$mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
if ($protocol == 'smtp') {
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = $host; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
@@ -372,8 +371,15 @@ class PhpMailController extends Controller
|
||||
$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->addAddress($recipants); // Add a recipient
|
||||
// Name is optional
|
||||
// $mail->addReplyTo('sada059@gmail.com', 'Information');
|
||||
@@ -388,9 +394,6 @@ class PhpMailController extends Controller
|
||||
$mail->addCC($collab_email);
|
||||
}
|
||||
}
|
||||
|
||||
$mail->addBCC($bc);
|
||||
|
||||
if ($attachment != null) {
|
||||
$size = count($message['attachments']);
|
||||
$attach = $message['attachments'];
|
||||
@@ -400,18 +403,17 @@ class PhpMailController extends Controller
|
||||
$mail->addAttachment($file_path, $file_name);
|
||||
}
|
||||
}
|
||||
|
||||
$mail->Subject = utf8_decode($subject);
|
||||
|
||||
$mail->Body = utf8_decode($content);
|
||||
|
||||
// $mail->AltBody = $altbody;
|
||||
|
||||
$mail->CharSet = "utf8";
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $content;
|
||||
if (!$mail->send()) {
|
||||
// echo 'Message could not be sent.';
|
||||
// echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
} else {
|
||||
// echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
if($e instanceof ErrorException) {
|
||||
return \Lang::get('lang.outgoing_email_failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,8 +422,7 @@ class PhpMailController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company()
|
||||
{
|
||||
public function company() {
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = 'Support Center';
|
||||
@@ -440,8 +441,7 @@ class PhpMailController extends Controller
|
||||
*
|
||||
* @return type integer
|
||||
*/
|
||||
public function mailfrom($reg, $dept_id)
|
||||
{
|
||||
public function mailfrom($reg, $dept_id) {
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
if ($reg == 1) {
|
||||
return $email->sys_email;
|
||||
@@ -454,4 +454,5 @@ class PhpMailController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
43
app/Http/Controllers/Common/PushNotificationController.php
Normal file
43
app/Http/Controllers/Common/PushNotificationController.php
Normal 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) {
|
||||
}
|
||||
|
||||
}
|
@@ -27,25 +27,16 @@ use Lang;
|
||||
* ***************************
|
||||
* Controller to keep smtp details and fetch where ever needed.
|
||||
*/
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// $this->smtp();
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$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
|
||||
*/
|
||||
public function widgets()
|
||||
{
|
||||
public function widgets() {
|
||||
return view('themes.default1.admin.helpdesk.theme.widgets');
|
||||
}
|
||||
|
||||
@@ -63,8 +53,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function list_widget()
|
||||
{
|
||||
public function list_widget() {
|
||||
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'title', 'value')
|
||||
@@ -78,33 +67,33 @@ class SettingsController extends Controller
|
||||
return $model->value;
|
||||
})
|
||||
->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>
|
||||
<div class="modal fade" id="edit_widget'.$model->id.'">
|
||||
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-dialog">
|
||||
<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">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>'.\Lang::get('lang.title').'</label><br/>
|
||||
<input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%">
|
||||
<label>' . \Lang::get('lang.title') . '</label><br/>
|
||||
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%">
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>'.\Lang::get('lang.content').'</label><br/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea>
|
||||
<label>' . \Lang::get('lang.content') . '</label><br/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<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').'">
|
||||
<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') . '">
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#Content'.$model->id.'").wysihtml5();
|
||||
$("#Content' . $model->id . '").wysihtml5();
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
@@ -123,15 +112,13 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function edit_widget($id, Widgets $widgets, Request $request)
|
||||
{
|
||||
public function edit_widget($id, Widgets $widgets, Request $request) {
|
||||
$widget = $widgets->where('id', '=', $id)->first();
|
||||
$widget->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try {
|
||||
$widget->save();
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.Lang::get('lang.saved_successfully'));
|
||||
return redirect()->back()->with('success', $widget->name . Lang::get('lang.saved_successfully'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
@@ -142,8 +129,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function social_buttons()
|
||||
{
|
||||
public function social_buttons() {
|
||||
return view('themes.default1.admin.helpdesk.theme.social');
|
||||
}
|
||||
|
||||
@@ -152,8 +138,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function list_social_buttons()
|
||||
{
|
||||
public function list_social_buttons() {
|
||||
return \Datatable::collection(Widgets::where('id', '>', '6')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'value')
|
||||
@@ -164,25 +149,25 @@ class SettingsController extends Controller
|
||||
return $model->value;
|
||||
})
|
||||
->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>
|
||||
<div class="modal fade" id="edit_widget'.$model->id.'">
|
||||
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-dialog">
|
||||
<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">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>'.\Lang::get('lang.link').'</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
|
||||
<label>' . \Lang::get('lang.link') . '</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<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').'">
|
||||
<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') . '">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -200,116 +185,26 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function edit_social_buttons($id, Widgets $widgets, Request $request)
|
||||
{
|
||||
public function edit_social_buttons($id, Widgets $widgets, Request $request) {
|
||||
$widget = $widgets->where('id', '=', $id)->first();
|
||||
$widget->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try {
|
||||
$widget->save();
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
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.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getsmtp()
|
||||
{
|
||||
public function getsmtp() {
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
|
||||
}
|
||||
|
||||
@@ -318,8 +213,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postsmtp(SmtpRequest $request)
|
||||
{
|
||||
public function postsmtp(SmtpRequest $request) {
|
||||
$data = Smtp::where('id', '=', 1)->first();
|
||||
$data->driver = $request->input('driver');
|
||||
$data->host = $request->input('host');
|
||||
@@ -330,47 +224,12 @@ class SettingsController extends Controller
|
||||
$data->password = Crypt::encrypt($request->input('password'));
|
||||
try {
|
||||
$data->save();
|
||||
|
||||
return \Redirect::route('getsmtp')->with('success', 'success');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -379,8 +238,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function PostSettings(Settings $set, Request $request)
|
||||
{
|
||||
public function PostSettings(Settings $set, Request $request) {
|
||||
$settings = $set->where('id', '1')->first();
|
||||
$pass = $request->input('password');
|
||||
$password = Crypt::encrypt($pass);
|
||||
@@ -393,7 +251,7 @@ class SettingsController extends Controller
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'dist/logo';
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$settings->logo = $fileName;
|
||||
$settings->save();
|
||||
@@ -407,60 +265,11 @@ class SettingsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
public function Plugins() {
|
||||
return view('themes.default1.admin.helpdesk.settings.plugins');
|
||||
}
|
||||
|
||||
public function GetPlugin()
|
||||
{
|
||||
public function GetPlugin() {
|
||||
$plugins = $this->fetchConfig();
|
||||
|
||||
return \Datatable::collection(new Collection($plugins))
|
||||
@@ -468,15 +277,15 @@ class SettingsController extends Controller
|
||||
->addColumn('name', function ($model) {
|
||||
if (array_has($model, 'path')) {
|
||||
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 = ' ';
|
||||
} else {
|
||||
$settings = '<a href='.url($model['settings']).'>Settings</a> | ';
|
||||
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Deactivate</a>';
|
||||
$settings = '<a href=' . url($model['settings']) . '>Settings</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>"
|
||||
."<div class='modal fade' id=del".$model['path'].">
|
||||
$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-dialog'>
|
||||
<div class=modal-content>
|
||||
<div class=modal-header>
|
||||
@@ -485,8 +294,8 @@ class SettingsController extends Controller
|
||||
<div class=modal-body>
|
||||
<p>Are you Sure ?</p>
|
||||
<div class=modal-footer>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -494,12 +303,12 @@ class SettingsController extends Controller
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
$action = '<br><br>'.$delete.' | '.$settings.$activate;
|
||||
$action = '<br><br>' . $delete . ' | ' . $settings . $activate;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
return ucfirst($model['name']).$action;
|
||||
return ucfirst($model['name']) . $action;
|
||||
})
|
||||
->addColumn('description', function ($model) {
|
||||
return ucfirst($model['description']);
|
||||
@@ -508,7 +317,7 @@ class SettingsController extends Controller
|
||||
return ucfirst($model['author']);
|
||||
})
|
||||
->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) {
|
||||
return $model['version'];
|
||||
@@ -521,9 +330,8 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ReadPlugins()
|
||||
{
|
||||
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins';
|
||||
public function ReadPlugins() {
|
||||
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
|
||||
$plugins = array_diff(scandir($dir), ['.', '..']);
|
||||
|
||||
return $plugins;
|
||||
@@ -536,13 +344,15 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function PostPlugins(Request $request)
|
||||
{
|
||||
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
||||
public function PostPlugins(Request $request) {
|
||||
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
||||
try {
|
||||
if (!extension_loaded('zip')){
|
||||
throw new Exception('Please enable zip extension in your php');
|
||||
}
|
||||
$plug = new Plugin();
|
||||
$file = $request->file('plugin');
|
||||
//dd($file);
|
||||
$destination = app_path().DIRECTORY_SEPARATOR.'Plugins';
|
||||
$destination = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
|
||||
$zipfile = $file->getRealPath();
|
||||
/*
|
||||
* get the file name and remove .zip
|
||||
@@ -551,45 +361,49 @@ class SettingsController extends Controller
|
||||
$filename2 = str_replace('.zip', '', $filename2);
|
||||
$filename1 = ucfirst($file->getClientOriginalName());
|
||||
$filename = str_replace('.zip', '', $filename1);
|
||||
mkdir($destination.DIRECTORY_SEPARATOR.$filename);
|
||||
$dir_check = scandir($destination);
|
||||
if (in_array($filename, $dir_check)) {
|
||||
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);
|
||||
\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)) {
|
||||
$seviceporvider = $file.DIRECTORY_SEPARATOR.'ServiceProvider.php';
|
||||
$config = $file.DIRECTORY_SEPARATOR.'config.php';
|
||||
$seviceporvider = $file . DIRECTORY_SEPARATOR . 'ServiceProvider.php';
|
||||
$config = $file . DIRECTORY_SEPARATOR . 'config.php';
|
||||
if (file_exists($seviceporvider) && file_exists($config)) {
|
||||
/*
|
||||
* move to faveo config
|
||||
*/
|
||||
$faveoconfig = config_path().DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$filename.'.php';
|
||||
$faveoconfig = config_path() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $filename . '.php';
|
||||
if ($faveoconfig) {
|
||||
|
||||
//copy($config, $faveoconfig);
|
||||
/*
|
||||
* write provider list in app.php line 128
|
||||
*/
|
||||
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
chmod($app, 0644);
|
||||
$str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
|
||||
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$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');
|
||||
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', 'Their is no '.$file);
|
||||
return redirect()->back()->with('fails', Lang::get('no-plugin-file') . $file);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@@ -597,7 +411,7 @@ class SettingsController extends Controller
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> '.$file);
|
||||
return redirect()->back()->with('fails', Lang::get('plugin-config-missing') . $file);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@@ -605,7 +419,10 @@ class SettingsController extends Controller
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> '.$file);
|
||||
return redirect()->back()->with('fails', '<b>' . Lang::get('lang.plugin-path-missing') . '</b> ' . $file);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,8 +433,7 @@ class SettingsController extends Controller
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteDirectory($dir)
|
||||
{
|
||||
public function deleteDirectory($dir) {
|
||||
if (!file_exists($dir)) {
|
||||
return true;
|
||||
}
|
||||
@@ -628,8 +444,8 @@ class SettingsController extends Controller
|
||||
if ($item == '.' || $item == '..') {
|
||||
continue;
|
||||
}
|
||||
chmod($dir.DIRECTORY_SEPARATOR.$item, 0777);
|
||||
if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) {
|
||||
chmod($dir . DIRECTORY_SEPARATOR . $item, 0777);
|
||||
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -638,9 +454,8 @@ class SettingsController extends Controller
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
public function ReadConfigs()
|
||||
{
|
||||
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR;
|
||||
public function ReadConfigs() {
|
||||
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR;
|
||||
$directories = scandir($dir);
|
||||
$files = [];
|
||||
foreach ($directories as $key => $file) {
|
||||
@@ -648,7 +463,7 @@ class SettingsController extends Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_dir($dir.DIRECTORY_SEPARATOR.$file)) {
|
||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
|
||||
$files[$key] = $file;
|
||||
}
|
||||
}
|
||||
@@ -657,7 +472,7 @@ class SettingsController extends Controller
|
||||
$plugins = [];
|
||||
if (count($files) > 0) {
|
||||
foreach ($files as $key => $file) {
|
||||
$plugin = $dir.$file;
|
||||
$plugin = $dir . $file;
|
||||
$plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
|
||||
$plugins[$key]['file'] = $plugin;
|
||||
}
|
||||
@@ -667,7 +482,7 @@ class SettingsController extends Controller
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file == 'config.php') {
|
||||
$config[] = $dir.DIRECTORY_SEPARATOR.$file;
|
||||
$config[] = $dir . DIRECTORY_SEPARATOR . $file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
@@ -680,8 +495,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function fetchConfig()
|
||||
{
|
||||
public function fetchConfig() {
|
||||
$configs = $this->ReadConfigs();
|
||||
//dd($configs);
|
||||
$plugs = new Plugin();
|
||||
@@ -717,15 +531,14 @@ class SettingsController extends Controller
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
public function DeletePlugin($slug)
|
||||
{
|
||||
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$slug;
|
||||
public function DeletePlugin($slug) {
|
||||
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $slug;
|
||||
$this->deleteDirectory($dir);
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$file_contents = file_get_contents($path_to_file);
|
||||
$file_contents = str_replace($str, '//', $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');
|
||||
}
|
||||
|
||||
public function StatusPlugin($slug)
|
||||
{
|
||||
public function StatusPlugin($slug) {
|
||||
$plugs = new Plugin();
|
||||
$plug = $plugs->where('name', $slug)->first();
|
||||
if (!$plug) {
|
||||
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
@@ -757,8 +569,8 @@ class SettingsController extends Controller
|
||||
if ($status == 0) {
|
||||
$plug->status = 1;
|
||||
|
||||
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
@@ -769,8 +581,8 @@ class SettingsController extends Controller
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
|
||||
$file_contents = file_get_contents($path_to_file);
|
||||
$file_contents = str_replace($str, '//', $file_contents);
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
@@ -38,13 +39,6 @@ class HomeController extends Controller
|
||||
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()
|
||||
{
|
||||
return \View::make('emails/notifications/agent');
|
||||
|
@@ -9,26 +9,25 @@ use Artisan;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpgradeController extends Controller
|
||||
{
|
||||
class UpgradeController extends Controller {
|
||||
|
||||
public $dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct() {
|
||||
$dir = base_path();
|
||||
$this->dir = $dir;
|
||||
}
|
||||
|
||||
public function getLatestVersion()
|
||||
{
|
||||
public function getLatestVersion() {
|
||||
try {
|
||||
$name = \Config::get('app.name');
|
||||
//dd($name);
|
||||
//serial key should be encrypted data
|
||||
$serial_key = Utility::encryptByFaveoPublicKey('O5Y647RJF8QHLDOE');
|
||||
$serial_key = '64JAHF9WVJA4GCUZ';
|
||||
//order number should be encrypted data
|
||||
$order_number = Utility::encryptByFaveoPublicKey('23540755');
|
||||
$url = url('/');
|
||||
//dd($url);
|
||||
$post_data = [
|
||||
$order_number = '44596328';
|
||||
$url = env('APP_URL');
|
||||
$data = [
|
||||
'serial_key' => $serial_key,
|
||||
'order_number' => $order_number,
|
||||
'name' => $name,
|
||||
@@ -36,12 +35,16 @@ class UpgradeController extends Controller
|
||||
'request_type' => 'check_update',
|
||||
'url' => $url,
|
||||
];
|
||||
$url = 'http://www.faveohelpdesk.com/billing/verification';
|
||||
$data = Utility::encryptByFaveoPublicKey(json_encode($data));
|
||||
//dd($data);
|
||||
$post_data = [
|
||||
'data' => $data
|
||||
];
|
||||
$url = 'http://faveohelpdesk.com/billing/public/verification';
|
||||
if (str_contains($url, ' ')) {
|
||||
$url = str_replace(' ', '%20', $url);
|
||||
}
|
||||
$curl = $this->postCurl($url, $post_data);
|
||||
//dd($curl);
|
||||
if (is_array($curl)) {
|
||||
if (array_key_exists('status', $curl)) {
|
||||
if ($curl['status'] == 'success') {
|
||||
@@ -51,27 +54,28 @@ class UpgradeController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function downloadLatestCode()
|
||||
{
|
||||
public function downloadLatestCode() {
|
||||
$name = \Config::get('app.name');
|
||||
$url = 'http://www.faveohelpdesk.com/billing/download-url';
|
||||
if (str_contains($url, ' ')) {
|
||||
$url = str_replace(' ', '%20', $url);
|
||||
$durl = 'http://www.faveohelpdesk.com/billing/public/download-url';
|
||||
if (str_contains($durl, ' ')) {
|
||||
$durl = str_replace(' ', '%20', $durl);
|
||||
}
|
||||
$data = [
|
||||
'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>';
|
||||
$context = stream_context_create(
|
||||
[
|
||||
@@ -83,10 +87,10 @@ class UpgradeController extends Controller
|
||||
|
||||
$newUpdate = file_get_contents($download_url, false, $context);
|
||||
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)) {
|
||||
echo '<p>Could not save new update. Operation aborted.</p>';
|
||||
exit();
|
||||
@@ -95,12 +99,25 @@ class UpgradeController extends Controller
|
||||
echo '<p>Update Downloaded And Saved</p>';
|
||||
}
|
||||
|
||||
public function doUpdate()
|
||||
{
|
||||
Artisan::call('down');
|
||||
$update = $this->dir.'/UPDATES';
|
||||
public function doUpdate() {
|
||||
try {
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
if ($memory_limit < 256) {
|
||||
echo '<ul class=list-unstyled>';
|
||||
echo "<li style='color:red;'>Sorry we can not process your request because of limited memory! You have only $memory_limit. For this you need atleast 256 MB</li>";
|
||||
echo '</ul>';
|
||||
return 0;
|
||||
}
|
||||
if (!extension_loaded('zip')) {
|
||||
echo '<ul class=list-unstyled>';
|
||||
echo "<li style='color:red;'>Sorry we can not process your request because you don't have ZIP extension contact your system admin</li>";
|
||||
echo '</ul>';
|
||||
return 0;
|
||||
}
|
||||
//Artisan::call('down');
|
||||
$update = $this->dir . '/UPDATES';
|
||||
//Open The File And Do Stuff
|
||||
$zipHandle = zip_open($update.'/faveo-helpdesk-master.zip');
|
||||
$zipHandle = zip_open($update . '/faveo-helpdesk-master.zip');
|
||||
//dd($update . '/faveo-' . $aV . '.zip');
|
||||
|
||||
echo '<ul class=list-unstyled>';
|
||||
@@ -115,28 +132,28 @@ class UpgradeController extends Controller
|
||||
|
||||
|
||||
//Make the directory if we need to...
|
||||
if (!is_dir($update.'/'.$thisFileDir.'/')) {
|
||||
\File::makeDirectory($update.'/'.$thisFileDir, 0775, true, true);
|
||||
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>';
|
||||
echo '<li style="color:white;">Created Directory ' . $thisFileDir . '</li>';
|
||||
}
|
||||
|
||||
//Overwrite the file
|
||||
if (!is_dir($update.'/'.$thisFileName)) {
|
||||
echo '<li style="color:white;">'.$thisFileName.'...........';
|
||||
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');
|
||||
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');
|
||||
$updateThis = fopen($update . '/' . $thisFileName, 'w');
|
||||
fwrite($updateThis, $contents);
|
||||
fclose($updateThis);
|
||||
unset($contents);
|
||||
@@ -145,14 +162,18 @@ class UpgradeController extends Controller
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
|
||||
Artisan::call('up');
|
||||
|
||||
//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>';
|
||||
}
|
||||
}
|
||||
|
||||
public function copyToActualDirectory($latest_version)
|
||||
{
|
||||
public function copyToActualDirectory($latest_version) {
|
||||
try {
|
||||
echo '<ul class=list-unstyled>';
|
||||
$directory = "$this->dir/UPDATES";
|
||||
$destination = $this->dir;
|
||||
// $destination = "/Applications/AMPPS/www/test/new";
|
||||
@@ -162,18 +183,24 @@ class UpgradeController extends Controller
|
||||
// echo "Destination Directory => $destination <br>";
|
||||
foreach ($directories as $source) {
|
||||
$success = \File::copyDirectory($source, $destination);
|
||||
echo '<p class="success">» </p>';
|
||||
echo '<li class="success">» </li>';
|
||||
}
|
||||
|
||||
\File::deleteDirectory($directory);
|
||||
|
||||
$this->deleteBarNotification('new-version');
|
||||
|
||||
echo '<p class="success">» Faveo Updated to v'.Utility::getFileVersion().'</p>';
|
||||
echo "<li style='color:green;'>» 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();
|
||||
}
|
||||
|
||||
public function deleteBarNotification($key)
|
||||
{
|
||||
public function deleteBarNotification($key) {
|
||||
try {
|
||||
$noti = new BarNotification();
|
||||
$notifications = $noti->where('key', $key)->get();
|
||||
@@ -185,45 +212,43 @@ class UpgradeController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function fileUpdate()
|
||||
{
|
||||
public function fileUpdate() {
|
||||
try {
|
||||
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
|
||||
$latest_version = $this->getLatestVersion();
|
||||
if (Utility::getFileVersion() < $latest_version) {
|
||||
$url = url('file-upgrade');
|
||||
//$string = "Your Database is outdated please upgrade <a href=$url>Now !</a>";
|
||||
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) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function fileUpgrading(Request $request)
|
||||
{
|
||||
public function fileUpgrading(Request $request) {
|
||||
try {
|
||||
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
|
||||
//
|
||||
$latest_version = $this->getLatestVersion();
|
||||
//dd($latest_version);
|
||||
|
||||
$current_version = Utility::getFileVersion();
|
||||
if ($latest_version != '') {
|
||||
$_this = new self();
|
||||
if (Utility::getFileVersion() < $latest_version) {
|
||||
|
||||
return view('themes.default1.update.test', compact('latest_version', 'current_version', 'request'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails', 'Could not find latest realeases from repository.');
|
||||
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) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function testScroll()
|
||||
{
|
||||
public function testScroll() {
|
||||
$ex = 1000;
|
||||
echo '<ul style=list-unstyled>';
|
||||
for ($i = 0; $i < $ex; $i++) {
|
||||
@@ -232,8 +257,7 @@ class UpgradeController extends Controller
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
public function fileUpgrading1(Request $request)
|
||||
{
|
||||
public function fileUpgrading1(Request $request) {
|
||||
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
|
||||
$latest_version = $this->getLatestVersion();
|
||||
// dd($latest_version);
|
||||
@@ -243,7 +267,7 @@ class UpgradeController extends Controller
|
||||
echo "<p>CURRENT VERSION: $current_version</p>";
|
||||
echo '<p>Reading Current Releases List</p>';
|
||||
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;
|
||||
if (!is_file("$this->dir/UPDATES/faveo-helpdesk-master.zip")) {
|
||||
if ($request->get('dodownload') == true) {
|
||||
@@ -254,7 +278,7 @@ class UpgradeController extends Controller
|
||||
echo '<p>Error in you network connection.</p>';
|
||||
}
|
||||
} else {
|
||||
echo '<p>Latest code found. <a href='.url('file-upgrade?dodownload=true').'>» Download Now?</a></p>';
|
||||
echo '<p>Latest code found. <a href=' . url('file-upgrade?dodownload=true') . '>» Download Now?</a></p>';
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
@@ -263,7 +287,7 @@ class UpgradeController extends Controller
|
||||
if ($request->get('doUpdate') == true) {
|
||||
$updated = $this->doUpdate();
|
||||
} else {
|
||||
echo '<p>Update ready. <a href='.url('file-upgrade?doUpdate=true').'>» Install Now?</a></p>';
|
||||
echo '<p>Update ready. <a href=' . url('file-upgrade?doUpdate=true') . '>» Install Now?</a></p>';
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -283,40 +307,73 @@ class UpgradeController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurl($url)
|
||||
{
|
||||
public function getCurl($url) {
|
||||
try {
|
||||
$curl = Utility::_isCurl();
|
||||
if (!$curl) {
|
||||
throw new Exception("Please enable your curl function to check latest update");
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
//curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
if (curl_exec($ch) === false) {
|
||||
echo 'Curl error: '.curl_error($ch);
|
||||
echo 'Curl error: ' . curl_error($ch);
|
||||
}
|
||||
$data = curl_exec($ch);
|
||||
dd($data);
|
||||
curl_close($ch);
|
||||
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function postCurl($url, $data)
|
||||
{
|
||||
public function postDownloadCurl($url, $data) {
|
||||
try {
|
||||
$curl = Utility::_isCurl();
|
||||
if (!$curl) {
|
||||
throw new Exception("Please enable your curl function to check latest update");
|
||||
}
|
||||
$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);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
|
||||
$url = url('database-upgrade');
|
||||
@@ -330,8 +387,7 @@ class UpgradeController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function databaseUpgrade()
|
||||
{
|
||||
public function databaseUpgrade() {
|
||||
try {
|
||||
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
@@ -344,4 +400,5 @@ class UpgradeController extends Controller
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,10 +7,9 @@ use Config;
|
||||
use Exception;
|
||||
use Schema;
|
||||
|
||||
class LibraryController extends Controller
|
||||
{
|
||||
public static function getFileVersion()
|
||||
{
|
||||
class LibraryController extends Controller {
|
||||
|
||||
public static function getFileVersion() {
|
||||
try {
|
||||
$app = Config::get('app.version');
|
||||
if ($app) {
|
||||
@@ -23,8 +22,7 @@ class LibraryController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDatabaseVersion()
|
||||
{
|
||||
public static function getDatabaseVersion() {
|
||||
try {
|
||||
$database = self::isDatabaseSetup();
|
||||
if ($database == true) {
|
||||
@@ -41,8 +39,7 @@ class LibraryController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public static function isDatabaseSetup()
|
||||
{
|
||||
public static function isDatabaseSetup() {
|
||||
try {
|
||||
if (Schema::hasTable('settings_system')) {
|
||||
return true;
|
||||
@@ -52,78 +49,47 @@ class LibraryController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public static function encryptByFaveoPublicKey($plaintext)
|
||||
{
|
||||
public static function encryptByFaveoPublicKey($data) {
|
||||
try {
|
||||
// Compress the data to be sent
|
||||
$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);
|
||||
|
||||
$path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key';
|
||||
//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Ù(ÆŒÁ$‘¥±Zj*îàÒö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);
|
||||
if (!$privateKey = openssl_pkey_get_private($key_content)) {
|
||||
die('Private Key failed');
|
||||
}
|
||||
$a_key = openssl_pkey_get_details($privateKey);
|
||||
$public_key = openssl_get_publickey($key_content);
|
||||
|
||||
// Decrypt the data in the small chunks
|
||||
$chunkSize = ceil($a_key['bits'] / 8);
|
||||
$output = '';
|
||||
$encrypted = $e = NULL;
|
||||
openssl_seal($data, $encrypted, $e, array($public_key));
|
||||
|
||||
while ($encrypted) {
|
||||
$chunk = substr($encrypted, 0, $chunkSize);
|
||||
$encrypted = substr($encrypted, $chunkSize);
|
||||
$decrypted = '';
|
||||
if (!openssl_private_decrypt($chunk, $decrypted, $privateKey)) {
|
||||
die('Failed to decrypt data');
|
||||
}
|
||||
$output .= $decrypted;
|
||||
}
|
||||
openssl_free_key($privateKey);
|
||||
$sealed_data = base64_encode($encrypted);
|
||||
$envelope = base64_encode($e[0]);
|
||||
|
||||
// Uncompress the unencrypted data.
|
||||
$output = gzuncompress($output);
|
||||
|
||||
echo '<br /><br /> Unencrypted Data: '.$output;
|
||||
$result = ['seal' => $sealed_data, 'envelope' => $envelope];
|
||||
return json_encode($result);
|
||||
} 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');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ class Kernel extends HttpKernel
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
//\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\App\Http\Middleware\LanguageMiddleware::class,
|
||||
|
||||
],
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
|
@@ -24,12 +24,12 @@ class CheckUpdate
|
||||
if ($check == true) {
|
||||
//$this->notificationBar();
|
||||
$this->checkNewUpdate();
|
||||
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
|
||||
return redirect('database-update');
|
||||
}
|
||||
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
|
||||
return redirect('file-update');
|
||||
}
|
||||
// if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
|
||||
// return redirect('database-update');
|
||||
// }
|
||||
// if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
|
||||
// return redirect('file-update');
|
||||
// }
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
@@ -56,7 +56,7 @@ class CheckUpdate
|
||||
$not = $notify->get();
|
||||
if ($not->count() > 0) {
|
||||
$now = \Carbon\Carbon::now();
|
||||
$yesterday = \Carbon\Carbon::now(-24);
|
||||
$yesterday = \Carbon\Carbon::yesterday();
|
||||
$notifications = $notify->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key');
|
||||
$todelete = $notify->where('created_at', '<', $yesterday)->get();
|
||||
if ($todelete->count() > 0) {
|
||||
@@ -113,7 +113,7 @@ class CheckUpdate
|
||||
|
||||
if ($n) {
|
||||
$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');
|
||||
if ($notifications->count() > 0) {
|
||||
return false;
|
||||
|
@@ -29,10 +29,10 @@ class AgentUpdate extends Request
|
||||
public function rules()
|
||||
{
|
||||
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',
|
||||
'last_name' => 'required|max:30',
|
||||
'email' => 'required|email',
|
||||
'email' => 'required|email|unique:users,email,'.$this->segment(2),
|
||||
'active' => 'required',
|
||||
'role' => 'required',
|
||||
'group' => 'required',
|
||||
|
@@ -31,7 +31,7 @@ class CreateTicketRequest extends Request
|
||||
return [
|
||||
|
||||
'email' => 'required|email|max:60',
|
||||
'fullname' => 'required|min:3|max:40',
|
||||
'user_name' => 'required|min:3|max:40',
|
||||
'helptopic' => 'required',
|
||||
// 'dept' => 'required',
|
||||
'sla' => 'required',
|
||||
|
@@ -29,10 +29,9 @@ class Sys_userRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'required|unique:users,email',
|
||||
'full_name' => 'required',
|
||||
// 'phone' => 'size:10',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
//use Illuminate\Http\Request as Req;
|
||||
/**
|
||||
* Sys_userUpdate.
|
||||
*
|
||||
@@ -29,9 +29,9 @@ class Sys_userUpdate extends Request
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'user_name' => 'required',
|
||||
// 'email' => 'required|email',
|
||||
// 'phone' => 'size:10',
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name,'.$this->segment(2),
|
||||
'email' => 'required|email|unique:users,email,'.$this->segment(2),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -9,15 +9,14 @@ use App\Http\Requests\Request;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TicketRequest extends Request
|
||||
{
|
||||
class TicketRequest extends Request {
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
public function authorize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,12 +25,46 @@ class TicketRequest extends Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'To' => 'required',
|
||||
'ticket_ID' => 'required',
|
||||
'reply_content' => 'required',
|
||||
];
|
||||
public function rules() {
|
||||
$error = "";
|
||||
try {
|
||||
$size = $this->size();
|
||||
if ($size > 800 || $size==0) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,9 +23,9 @@ class CategoryRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$id = $this->segment(2);
|
||||
return [
|
||||
'name' => 'required|max:250',
|
||||
'slug' => 'required|unique:kb_category',
|
||||
'name' => 'required|max:250|unique:kb_category,name,'.$id,
|
||||
'description' => 'required',
|
||||
];
|
||||
}
|
||||
|
@@ -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',
|
||||
];
|
||||
}
|
||||
}
|
@@ -23,10 +23,9 @@ class PageRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$slug = $this->segment(2);
|
||||
return [
|
||||
'name' => 'required',
|
||||
'slug' => 'required|unique:kb_pages',
|
||||
//'description' => 'required',
|
||||
'name' => 'required|unique:kb_pages,slug,'.$slug
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -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
40
app/Jobs/SendEmail.php
Normal 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);
|
||||
}
|
||||
}
|
@@ -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'];
|
||||
}
|
13
app/Model/helpdesk/Form/FieldValue.php
Normal file
13
app/Model/helpdesk/Form/FieldValue.php
Normal 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'];
|
||||
|
||||
|
||||
}
|
@@ -4,8 +4,8 @@ namespace App\Model\helpdesk\Form;
|
||||
|
||||
use App\BaseModel;
|
||||
|
||||
class Fields extends BaseModel
|
||||
{
|
||||
class Fields extends BaseModel {
|
||||
|
||||
protected $table = 'custom_form_fields';
|
||||
|
||||
/**
|
||||
@@ -14,4 +14,29 @@ class Fields extends BaseModel
|
||||
* @var array
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,4 +14,50 @@ class Forms extends BaseModel
|
||||
* @var array
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ class Ticket_Thread extends BaseModel
|
||||
{
|
||||
protected $table = 'ticket_thread';
|
||||
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()
|
||||
|
@@ -15,7 +15,7 @@ class Tickets extends BaseModel
|
||||
// }
|
||||
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()
|
||||
|
@@ -6,6 +6,6 @@ use App\BaseModel;
|
||||
|
||||
class Limit_Login extends BaseModel
|
||||
{
|
||||
protected $table = 'limit_login';
|
||||
protected $fillable = ['email', 'ip_address', 'duration', 'attempt_time', 'created_at', 'updated_at'];
|
||||
protected $table = 'login_attempts';
|
||||
protected $fillable = ['User', 'IP', 'Attempts', 'LastLogin', 'created_at', 'updated_at'];
|
||||
}
|
||||
|
@@ -47,12 +47,12 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
public function composer()
|
||||
{
|
||||
View::composer('themes.default1.update.notification', function () {
|
||||
\View::composer('themes.default1.update.notification', function () {
|
||||
$notification = new BarNotification();
|
||||
$data = [
|
||||
'data' => $notification->get(),
|
||||
$not = [
|
||||
'notification' => $notification->where('value','!=','')->get(),
|
||||
];
|
||||
view()->share($data);
|
||||
view()->share($not);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,10 @@ class ConfigServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
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/',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic',
|
||||
'phone_number', 'company', 'agent_sign', 'account_type', 'account_status',
|
||||
'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access',
|
||||
'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code', ];
|
||||
'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code','fcm_token' ];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
@@ -43,7 +43,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
if (!$value) {
|
||||
return \Gravatar::src($this->attributes['email']);
|
||||
} else {
|
||||
return asset('lb-faveo/media/profilepic/'.$value);
|
||||
return asset('uploads/profilepic/'.$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
ini_set('xdebug.max_nesting_level', 500);
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|
@@ -21,12 +21,14 @@
|
||||
"chumper/datatable": "dev-develop",
|
||||
"chumper/zipper": "0.6.x",
|
||||
"phpmailer/phpmailer": "^5.2",
|
||||
"bestmomo/filemanager": "1.1.*",
|
||||
"unisharp/laravel-filemanager": "^1.1",
|
||||
"tymon/jwt-auth": "0.5.*",
|
||||
"php": ">=5.5.9",
|
||||
"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": {
|
||||
"phpunit/phpunit": "~4.0",
|
||||
|
1016
composer.lock
generated
1016
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,8 @@ return [
|
||||
| This tells about aplication current version.
|
||||
|
|
||||
*/
|
||||
'version' => 'Community 1.0.7.8',
|
||||
'version' => 'Community 1.0.7.9',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
@@ -43,6 +44,7 @@ return [
|
||||
|
|
||||
*/
|
||||
'name' => 'Faveo helpdesk community',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
@@ -135,12 +137,16 @@ return [
|
||||
|
||||
'Illuminate\Broadcasting\BroadcastServiceProvider',
|
||||
'DaveJamesMiller\Breadcrumbs\ServiceProvider',
|
||||
/*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
'Illuminate\Auth\AuthServiceProvider',
|
||||
'Illuminate\Bus\BusServiceProvider',
|
||||
'Illuminate\Cache\CacheServiceProvider',
|
||||
@@ -151,7 +157,8 @@ return [
|
||||
'Illuminate\Filesystem\FilesystemServiceProvider',
|
||||
'Illuminate\Foundation\Providers\FoundationServiceProvider',
|
||||
'Illuminate\Hashing\HashServiceProvider',
|
||||
'Illuminate\Mail\MailServiceProvider',
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
|
||||
'Illuminate\Pagination\PaginationServiceProvider',
|
||||
'Illuminate\Pipeline\PipelineServiceProvider',
|
||||
'Illuminate\Queue\QueueServiceProvider',
|
||||
@@ -175,11 +182,13 @@ return [
|
||||
'Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider',
|
||||
'Chumper\Datatable\DatatableServiceProvider',
|
||||
'Chumper\Zipper\ZipperServiceProvider',
|
||||
'Bestmomo\Filemanager\FilemanagerServiceProvider',
|
||||
'Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider',
|
||||
'Intervention\Image\ImageServiceProvider',
|
||||
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
|
||||
Intervention\Image\ImageServiceProvider::class,
|
||||
|
||||
'Tymon\JWTAuth\Providers\JWTAuthServiceProvider',
|
||||
'Torann\GeoIP\GeoIPServiceProvider',
|
||||
LaravelFCM\FCMServiceProvider::class,
|
||||
Barryvdh\Debugbar\ServiceProvider::class,
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -234,12 +243,14 @@ return [
|
||||
'SMTPS' => 'App\Http\Controllers\HomeController',
|
||||
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
|
||||
'Zipper' => 'Chumper\Zipper\Zipper',
|
||||
'Image' => 'Intervention\Image\Facades\Image',
|
||||
'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
|
||||
'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory',
|
||||
'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',
|
||||
'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',
|
||||
];
|
@@ -2,6 +2,6 @@
|
||||
|
||||
return [
|
||||
|
||||
'view' => '_partials/breadcrumbs',
|
||||
'view' => '_partials.breadcrumbs',
|
||||
|
||||
];
|
||||
|
@@ -50,9 +50,9 @@ return [
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'database' => env('DB_DATABASE'),
|
||||
'username' => env('DB_USERNAME'),
|
||||
'password' => env('DB_PASSWORD'),
|
||||
'charset' => 'utf8',
|
||||
'collation' => 'utf8_unicode_ci',
|
||||
'port' => env('DB_PORT', ''),
|
||||
|
170
config/debugbar.php
Normal file
170
config/debugbar.php
Normal 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
14
config/fcm.php
Normal 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
|
||||
]
|
||||
];
|
@@ -22,7 +22,7 @@ return [
|
||||
| Defaults to 1 hour
|
||||
|
|
||||
*/
|
||||
'ttl' => 60,
|
||||
'ttl' => 4,
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Refresh time to live
|
||||
|
@@ -1,17 +1,55 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
// If true, the uploaded file will be renamed to uniqid() + file extension.
|
||||
'rename_file' => true,
|
||||
|
||||
// If rename_file set to false and this set to true, then filter filename characters which are not alphanumeric.
|
||||
'alphanumeric_filename' => true,
|
||||
|
||||
'use_package_routes' => true,
|
||||
'middlewares' => ['auth'],
|
||||
|
||||
// For laravel 5.2, please set to ['web', 'auth']
|
||||
'middlewares' => ['web'],
|
||||
|
||||
// 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' => '%url%',
|
||||
'files_dir' => 'public/files/',
|
||||
'files_url' => '/files/',
|
||||
|
||||
//'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',
|
||||
'docx' => 'Microsoft Word',
|
||||
@@ -26,6 +64,8 @@ return [
|
||||
'ppt' => 'Microsoft PowerPoint',
|
||||
'pptx' => 'Microsoft PowerPoint',
|
||||
],
|
||||
|
||||
// file extensions array, only for showing icons, it won't affect the upload process.
|
||||
'file_icon_array' => [
|
||||
'pdf' => 'fa-file-pdf-o',
|
||||
'docx' => 'fa-file-word-o',
|
||||
|
@@ -15,7 +15,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'mail',
|
||||
'driver' => 'smtp',
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Address
|
||||
|
@@ -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');
|
||||
}
|
||||
}
|
30
database/migrations/2016_06_28_141613_version1079table.php
Normal file
30
database/migrations/2016_06_28_141613_version1079table.php
Normal 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]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -6,7 +6,6 @@ use App\Model\Common\TemplateType;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Email\Smtp;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
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\Workflow\WorkflowClose;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\helpdesk\Utility\Limit_Login;
|
||||
use App\Model\Update\BarNotification;
|
||||
// Knowledge base
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@@ -46,7 +47,7 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
BarNotification::create(['id' => '1']);
|
||||
/* Date time format */
|
||||
$date_time_formats = [
|
||||
'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' => 'email', 'value' => 'E-mail']);
|
||||
Ticket_source::create(['name' => 'agent', 'value' => 'Agent Panel']);
|
||||
/* Mail configuration */
|
||||
Smtp::create(['id' => '1']);
|
||||
/* Version check */
|
||||
Version_Check::create(['id' => '1']);
|
||||
/* 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']);
|
||||
|
||||
Limit_Login::create(['id'=>'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' => '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!!} <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' => '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' => '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!!} <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!!}, <br><br>New ticket {!!$ticket_number!!} created <br>From<br>Name :- {!!$ticket_client_name!!} <br>E-mail :- {!!$ticket_client_email!!} <br><br>{!!$content!!} <br><br>Kind Regards,<br>{!!$system_from!!}</div><br>', '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!!} , </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!!} </p></span>', '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' => '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!!} <br></p><p>{!!$agent_sign!!} </p><p>Ticket Details</p><p>Ticket ID: {!!$ticket_number!!} </p><div><br></div></span><br></div><div><br></div></span>', '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' => '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!!} , </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!!} </p></span>', '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' => '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><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!!},<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' => '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!!}<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></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!!},<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' => '<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
|
||||
*/
|
||||
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
|
||||
|
18
example.env
18
example.env
@@ -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
|
@@ -1,5 +0,0 @@
|
||||
suites:
|
||||
main:
|
||||
namespace: App
|
||||
psr4_prefix: App
|
||||
src_path: app
|
@@ -13,3 +13,22 @@
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</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>
|
||||
|
||||
|
@@ -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 |
1
public/filemanager/.gitignore
vendored
1
public/filemanager/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
scripts/filemanager.config.js
|
@@ -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 :
|
||||
[](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
|
||||
-------------
|
||||
|
||||

|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
@@ -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"
|
||||
]
|
||||
}
|
@@ -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
|
@@ -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"
|
||||
}
|
||||
}
|
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Filemanager PHP connector
|
||||
* This file should at least declare auth() function
|
||||
* and instantiate the Filemanager as '$fm'.
|
||||
*
|
||||
* IMPORTANT : by default Read and Write access is granted to everyone
|
||||
* Copy/paste this file to 'user.config.php' file to implement your own auth() function
|
||||
* to grant access to wanted users only
|
||||
*
|
||||
* filemanager.php
|
||||
* use for ckeditor filemanager
|
||||
*
|
||||
* @license MIT License
|
||||
* @author Simon Georget <simon (at) linea21 (dot) com>
|
||||
* @copyright Authors
|
||||
*/
|
||||
|
||||
// Laravel init
|
||||
require getcwd().'/../../../../bootstrap/autoload.php';
|
||||
$app = require_once getcwd().'/../../../../bootstrap/app.php';
|
||||
|
||||
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
|
||||
|
||||
$response = $kernel->handle(
|
||||
$request = Illuminate\Http\Request::capture()
|
||||
);
|
||||
|
||||
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
|
||||
$app['session']->driver()->setId($id);
|
||||
$app['session']->driver()->start();
|
||||
|
||||
// Folder path
|
||||
$folderPath = $app->basePath().'/public/'.config('filemanager.folder_path');
|
||||
|
||||
// Check if user in authentified
|
||||
if (!$app['auth']->check()) {
|
||||
$laravelAuth = false;
|
||||
} else {
|
||||
// Check if user has all access
|
||||
if ($app['auth']->user()->accessMediasAll()) {
|
||||
$laravelAuth = true;
|
||||
} elseif (method_exists($app['auth']->user(), 'accessMediasFolder')) {
|
||||
// Check if user has access to one folder
|
||||
if ($app['auth']->user()->accessMediasFolder()) {
|
||||
// Folder name with user id
|
||||
$folderPath .= 'user'.$app['auth']->id();
|
||||
// Create folder if doesn't exist
|
||||
if (!is_dir($folderPath)) {
|
||||
mkdir($folderPath);
|
||||
}
|
||||
$laravelAuth = true;
|
||||
} else {
|
||||
$laravelAuth = false;
|
||||
}
|
||||
} else {
|
||||
$laravelAuth = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is authorized.
|
||||
*
|
||||
*
|
||||
* @return bool true if access granted, false if no access
|
||||
*/
|
||||
function auth()
|
||||
{
|
||||
return $GLOBALS['laravelAuth'];
|
||||
}
|
||||
|
||||
$fm = new Filemanager();
|
||||
|
||||
$fm->setFileRoot($folderPath);
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user