Installer updates
Added probe.php Added new installer views and controllers Updated AuthController Updated Middlewares Updated Commands for installation process
This commit is contained in:
@@ -17,18 +17,18 @@ class BaseModel extends Model
|
||||
{
|
||||
public function setAttribute($property, $value)
|
||||
{
|
||||
require_once base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier.auto.php');
|
||||
$path = base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache'.DIRECTORY_SEPARATOR.'Serializer');
|
||||
if (!File::exists($path)) {
|
||||
File::makeDirectory($path, $mode = 0777, true, true);
|
||||
}
|
||||
$config = \HTMLPurifier_Config::createDefault();
|
||||
$config->set('HTML.Trusted', true);
|
||||
$config->set('Filter.YouTube', true);
|
||||
$purifier = new \HTMLPurifier($config);
|
||||
if ($value != strip_tags($value)) {
|
||||
$value = $purifier->purify($value);
|
||||
}
|
||||
// require_once base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier.auto.php');
|
||||
// $path = base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache'.DIRECTORY_SEPARATOR.'Serializer');
|
||||
// if (!File::exists($path)) {
|
||||
// File::makeDirectory($path, $mode = 0777, true, true);
|
||||
// }
|
||||
// $config = \HTMLPurifier_Config::createDefault();
|
||||
// $config->set('HTML.Trusted', true);
|
||||
// $config->set('Filter.YouTube', true);
|
||||
// $purifier = new \HTMLPurifier($config);
|
||||
// if ($value != strip_tags($value)) {
|
||||
// $value = $purifier->purify($value);
|
||||
// }
|
||||
parent::setAttribute($property, $value);
|
||||
}
|
||||
}
|
||||
|
56
app/Console/Commands/DropTables.php
Normal file
56
app/Console/Commands/DropTables.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DropTables extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'droptables';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Drops all tables';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$colname = 'Tables_in_'.env('DB_DATABASE');
|
||||
|
||||
$droplist = \Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
|
||||
$droplist = implode(',', $droplist);
|
||||
|
||||
DB::beginTransaction();
|
||||
//turn off referential integrity
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS = 0');
|
||||
DB::statement("DROP TABLE $droplist");
|
||||
//turn referential integrity back on
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
|
||||
DB::commit();
|
||||
|
||||
$this->comment(PHP_EOL.'If no errors showed up, all tables were dropped'.PHP_EOL);
|
||||
}
|
||||
}
|
103
app/Console/Commands/Install.php
Normal file
103
app/Console/Commands/Install.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Http\Controllers\Installer\helpdesk\InstallController;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Install extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'install:faveo';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'to install faveo';
|
||||
protected $install;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->install = new InstallController();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$this->appEnv();
|
||||
if ($this->confirm('Do you want to intall faveo?')) {
|
||||
$default = $this->choice(
|
||||
'Which sql engine would you like to use?', ['mysql']
|
||||
);
|
||||
$host = $this->ask('Enter your sql host');
|
||||
$database = $this->ask('Enter your database name');
|
||||
$dbusername = $this->ask('Enter your database username');
|
||||
$dbpassword = $this->ask('Enter your database password (blank if not entered)', false);
|
||||
$port = $this->ask('Enter your sql port (blank if not entered)', false);
|
||||
$this->install->env($default, $host, $port, $database, $dbusername, $dbpassword);
|
||||
$this->info('.env file has created');
|
||||
$this->call('preinsatall:check');
|
||||
$this->alert("please run 'php artisan install:db'");
|
||||
} else {
|
||||
$this->info('We hope, you will try next time');
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function appEnv()
|
||||
{
|
||||
$extensions = [
|
||||
'curl',
|
||||
'ctype',
|
||||
'imap',
|
||||
'mbstring',
|
||||
'mcrypt',
|
||||
'mysql',
|
||||
'openssl',
|
||||
'tokenizer',
|
||||
'zip',
|
||||
'pdo',
|
||||
'mysqli',
|
||||
'bcmath',
|
||||
'iconv',
|
||||
//'ioncube_loader_dar_5.6',
|
||||
];
|
||||
$result = [];
|
||||
foreach ($extensions as $key => $extension) {
|
||||
$result[$key]['extension'] = $extension;
|
||||
if (!extension_loaded($extension)) {
|
||||
$result[$key]['status'] = "Not Loading, Please open '".php_ini_loaded_file()."' and add 'extension = ".$extension;
|
||||
} else {
|
||||
$result[$key]['status'] = 'Loading';
|
||||
}
|
||||
}
|
||||
$result['php']['extension'] = 'PHP';
|
||||
if (phpversion() === 7.0) {
|
||||
$result['php']['status'] = 'PHP version supports';
|
||||
} else {
|
||||
$result['php']['status'] = "PHP version doesn't supports please upgrade to 7.0";
|
||||
}
|
||||
|
||||
$headers = ['Extension', 'Status'];
|
||||
$this->table($headers, $result);
|
||||
}
|
||||
}
|
89
app/Console/Commands/InstallDB.php
Normal file
89
app/Console/Commands/InstallDB.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Http\Controllers\Installer\helpdesk\InstallController;
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class InstallDB extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'install:db';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'installing database';
|
||||
protected $install;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->install = new InstallController();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
if ($this->confirm('Do you want to migrate tables now?')) {
|
||||
$env = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
if (!is_file($env)) {
|
||||
throw new \Exception("Please run 'php artisan install:faveo'");
|
||||
}
|
||||
$dummy_confirm = $this->confirm('Would you like to install dummy data in database to test before going live?');
|
||||
$this->call('key:generate', ['--force' => true]);
|
||||
if (!$dummy_confirm) {
|
||||
$this->call('install:migrate');
|
||||
$this->call('install:seed');
|
||||
} else {
|
||||
$path = base_path().'/DB/dummy-data.sql';
|
||||
DB::unprepared(file_get_contents($path));
|
||||
}
|
||||
$headers = ['user_name', 'email', 'password'];
|
||||
$data = [
|
||||
[
|
||||
'user_name' => 'demo_admin',
|
||||
'email' => '',
|
||||
'password' => 'demopass',
|
||||
],
|
||||
];
|
||||
$this->table($headers, $data);
|
||||
$this->warn('Please update your email and change the password immediately');
|
||||
$this->install->updateInstalEnv();
|
||||
$this->updateAppUrl();
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAppUrl()
|
||||
{
|
||||
$url = $this->ask('Enter your app url (with http/https and www/non www)');
|
||||
if (str_finish($url, '/')) {
|
||||
$url = rtrim($url, '/ ');
|
||||
}
|
||||
$systems = new \App\Model\helpdesk\Settings\System();
|
||||
$system = $systems->first();
|
||||
$system->url = $url;
|
||||
$system->save();
|
||||
$this->info('Thank you! Faveo has been installed successfully');
|
||||
}
|
||||
}
|
47
app/Console/Commands/UpdateEncryption.php
Normal file
47
app/Console/Commands/UpdateEncryption.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class UpdateEncryption extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'encryption';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'This update the encryption value from old to AES-256-CBC';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$emails = \App\Model\helpdesk\Email\Emails::get();
|
||||
|
||||
foreach ($emails as $email) {
|
||||
$email->password = encrypt('password');
|
||||
$email->save();
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,6 +18,10 @@ class Kernel extends ConsoleKernel
|
||||
'App\Console\Commands\SendReport',
|
||||
'App\Console\Commands\CloseWork',
|
||||
'App\Console\Commands\TicketFetch',
|
||||
'App\Console\Commands\UpdateEncryption',
|
||||
\App\Console\Commands\DropTables::class,
|
||||
\App\Console\Commands\Install::class,
|
||||
\App\Console\Commands\InstallDB::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -33,9 +37,11 @@ class Kernel extends ConsoleKernel
|
||||
if ($this->getCurrentQueue() != 'sync') {
|
||||
$schedule->command('queue:listen '.$this->getCurrentQueue().' --sleep 60')->everyMinute();
|
||||
}
|
||||
|
||||
$this->execute($schedule, 'fetching');
|
||||
$this->execute($schedule, 'notification');
|
||||
$this->execute($schedule, 'work');
|
||||
$schedule->command('sla-escalate')->everyThirtyMinutes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,4 +120,14 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
return $queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Closure based commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
dd($e);
|
||||
$debug = \Config::get('app.bugsnag_reporting');
|
||||
$debug = ($debug) ? 'true' : 'false';
|
||||
if ($debug == 'false') {
|
||||
|
@@ -22,7 +22,7 @@ use Auth;
|
||||
use DateTime;
|
||||
use DB;
|
||||
use Hash;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Lang;
|
||||
use Socialite;
|
||||
|
||||
@@ -38,7 +38,6 @@ use Socialite;
|
||||
*/
|
||||
class AuthController extends Controller
|
||||
{
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
/* to redirect after login */
|
||||
|
||||
// if auth is agent
|
||||
@@ -644,4 +643,27 @@ class AuthController extends Controller
|
||||
\Session::set($provider.'redirect', $url);
|
||||
$this->changeRedirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the user out of the application.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getLogout(Request $request)
|
||||
{
|
||||
\Event::fire('user.logout', []);
|
||||
$login = new LoginController();
|
||||
|
||||
return $login->logout($request);
|
||||
}
|
||||
|
||||
public function redirectPath()
|
||||
{
|
||||
$auth = Auth::user();
|
||||
if ($auth && $auth->role != 'user') {
|
||||
return 'dashboard';
|
||||
} else {
|
||||
return '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,11 +5,9 @@ namespace App\Http\Controllers\Installer\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\DatabaseRequest;
|
||||
use App\Http\Requests\helpdesk\InstallerRequest;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
// models
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\User;
|
||||
use Artisan;
|
||||
@@ -46,15 +44,10 @@ class InstallController extends Controller
|
||||
*/
|
||||
public function licence()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
$directory = base_path();
|
||||
if (file_exists($directory.DIRECTORY_SEPARATOR.'.env')) {
|
||||
return redirect('/auth/login');
|
||||
if (Cache::get('step1') == 'step1') {
|
||||
return View::make('themes/default1/installer/helpdesk/view1');
|
||||
} else {
|
||||
Cache::flush();
|
||||
Artisan::call('config:clear');
|
||||
|
||||
return view('themes/default1/installer/helpdesk/view1');
|
||||
return Redirect::route('prerequisites');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +59,10 @@ class InstallController extends Controller
|
||||
public function licencecheck(Request $request)
|
||||
{
|
||||
// checking if the user have accepted the licence agreement
|
||||
$accept = (Input::has('accept1')) ? true : false;
|
||||
if ($accept == 'accept') {
|
||||
Cache::forever('step1', 'step1');
|
||||
if (Input::has('acceptme')) {
|
||||
Cache::forever('step2', 'step2');
|
||||
|
||||
return Redirect::route('prerequisites');
|
||||
return Redirect::route('configuration');
|
||||
} else {
|
||||
return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
}
|
||||
@@ -87,10 +79,14 @@ class InstallController extends Controller
|
||||
public function prerequisites(Request $request)
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Cache::get('step1') == 'step1') {
|
||||
return View::make('themes/default1/installer/helpdesk/view2');
|
||||
$directory = base_path();
|
||||
if (file_exists($directory.DIRECTORY_SEPARATOR.'.env')) {
|
||||
return redirect('/auth/login');
|
||||
} else {
|
||||
return Redirect::route('licence');
|
||||
Cache::flush();
|
||||
Artisan::call('config:clear');
|
||||
|
||||
return view('themes/default1/installer/helpdesk/view2');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,9 +98,9 @@ class InstallController extends Controller
|
||||
*/
|
||||
public function prerequisitescheck(Request $request)
|
||||
{
|
||||
Cache::forever('step2', 'step2');
|
||||
Cache::forever('step1', 'step1');
|
||||
|
||||
return Redirect::route('configuration');
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,69 +160,25 @@ class InstallController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configurationcheck(DatabaseRequest $request)
|
||||
public function configurationcheck(Request $request)
|
||||
{
|
||||
Cache::forever('step4', 'step4');
|
||||
|
||||
Session::set('default', $request->input('default'));
|
||||
Session::set('host', $request->input('host'));
|
||||
Session::set('databasename', $request->input('databasename'));
|
||||
Session::set('username', $request->input('username'));
|
||||
Session::set('password', $request->input('password'));
|
||||
Session::set('port', $request->input('port'));
|
||||
Session::put('default', $request->input('default'));
|
||||
Session::put('host', $request->input('host'));
|
||||
Session::put('databasename', $request->input('databasename'));
|
||||
Session::put('username', $request->input('username'));
|
||||
Session::put('password', $request->input('password'));
|
||||
Session::put('port', $request->input('port'));
|
||||
Cache::forever('dummy_data_installation', false);
|
||||
if ($request->has('dummy-data')) {
|
||||
Cache::forget('dummy_data_installation');
|
||||
Cache::forever('dummy_data_installation', true);
|
||||
}
|
||||
|
||||
return Redirect::route('database');
|
||||
}
|
||||
|
||||
/**
|
||||
* postconnection.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postconnection(Request $request)
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
$default = Input::get('default');
|
||||
$host = Input::get('host');
|
||||
$database = Input::get('databasename');
|
||||
$dbusername = Input::get('username');
|
||||
$dbpassword = Input::get('password');
|
||||
$port = Input::get('port');
|
||||
|
||||
$ENV['APP_ENV'] = 'production';
|
||||
$ENV['APP_DEBUG'] = 'false';
|
||||
$ENV['APP_KEY'] = 'SomeRandomString';
|
||||
$ENV['APP_BUGSNAG'] = 'true';
|
||||
$ENV['APP_URL'] = 'http://localhost';
|
||||
$ENV['DB_INSTALL'] = '%0%';
|
||||
$ENV['DB_TYPE'] = $default;
|
||||
$ENV['DB_HOST'] = $host;
|
||||
$ENV['DB_PORT'] = $port;
|
||||
$ENV['DB_DATABASE'] = $database;
|
||||
$ENV['DB_USERNAME'] = $dbusername;
|
||||
$ENV['DB_PASSWORD'] = $dbpassword;
|
||||
$ENV['MAIL_DRIVER'] = 'smtp';
|
||||
$ENV['MAIL_HOST'] = 'mailtrap.io';
|
||||
$ENV['MAIL_PORT'] = '2525';
|
||||
$ENV['MAIL_USERNAME'] = 'null';
|
||||
$ENV['MAIL_PASSWORD'] = 'null';
|
||||
$ENV['CACHE_DRIVER'] = 'file';
|
||||
$ENV['SESSION_DRIVER'] = 'file';
|
||||
$ENV['QUEUE_DRIVER'] = 'sync';
|
||||
|
||||
$config = '';
|
||||
foreach ($ENV as $key => $val) {
|
||||
$config .= "{$key}={$val}\n";
|
||||
}
|
||||
// Write environment file
|
||||
$fp = fopen(base_path().DIRECTORY_SEPARATOR.'example.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
rename(base_path().DIRECTORY_SEPARATOR.'example.env', base_path().DIRECTORY_SEPARATOR.'.env');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database
|
||||
* checking prerequisites.
|
||||
@@ -269,28 +221,24 @@ class InstallController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function accountcheck(InstallerRequest $request)
|
||||
public function accountcheck(Request $request)
|
||||
{
|
||||
// checking is the installation was done previously
|
||||
try {
|
||||
$check_for_pre_installation = System::all();
|
||||
if ($check_for_pre_installation) {
|
||||
rename(base_path().DIRECTORY_SEPARATOR.'.env', base_path().DIRECTORY_SEPARATOR.'example.env');
|
||||
Cache::put('fails', 'The data in database already exist. Please provide fresh database', 2);
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'firstname' => 'required|max:20',
|
||||
'Lastname' => 'required|max:20',
|
||||
'email' => 'required|max:50|email',
|
||||
'username' => 'required|max:50|min:3',
|
||||
'password' => 'required|min:6',
|
||||
'confirmpassword' => 'required|same:password',
|
||||
]);
|
||||
|
||||
return redirect()->route('configuration');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
if ($validator->fails()) {
|
||||
return redirect('step5')
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
if ($request->input('dummy-data') == 'on') {
|
||||
$path = base_path().'/DB/dummy-data.sql';
|
||||
DB::unprepared(file_get_contents($path));
|
||||
} else {
|
||||
// migrate database
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
}
|
||||
// create user
|
||||
// checking is the installation was done previously
|
||||
// Set variables fetched from input request
|
||||
$firstname = $request->input('firstname');
|
||||
$lastname = $request->input('Lastname');
|
||||
$email = $request->input('email');
|
||||
@@ -301,46 +249,49 @@ class InstallController extends Controller
|
||||
$timezone = $request->input('timezone');
|
||||
$date = $request->input('date');
|
||||
$datetime = $request->input('datetime');
|
||||
$lang_path = base_path('resources/lang');
|
||||
|
||||
//check user input language package is available or not in the system
|
||||
if (array_key_exists($language, \Config::get('languages')) && in_array($language, scandir($lang_path))) {
|
||||
// do something here
|
||||
} else {
|
||||
return \Redirect::back()->with('fails', 'Invalid language');
|
||||
}
|
||||
|
||||
$changed = UnAuth::changeLanguage($language);
|
||||
if (!$changed) {
|
||||
return \Redirect::back()->with('fails', 'Invalid language');
|
||||
}
|
||||
// checking requested timezone for the admin and system
|
||||
$timezones = Timezones::where('name', '=', $timezone)->first();
|
||||
if ($timezones == null) {
|
||||
return redirect()->back()->with('fails', 'Invalid time-zone');
|
||||
}
|
||||
|
||||
// checking requested date time format for the admin and system
|
||||
$date_time_format = Date_time_format::where('format', '=', $datetime)->first();
|
||||
if ($date_time_format == null) {
|
||||
return redirect()->back()->with('fails', 'invalid date-time format');
|
||||
}
|
||||
|
||||
// Creating minum settings for system
|
||||
$system = new System();
|
||||
$system = System::where('id', '=', 1)->first();
|
||||
$system->status = 1;
|
||||
$system->department = 1;
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
$system->time_zone = $timezones->id;
|
||||
$version = \Config::get('app.version');
|
||||
$version = explode(' ', $version);
|
||||
$version = $version[1];
|
||||
$system->date_time_format = $datetime; //$date_time_format->id;
|
||||
$system->time_zone = $timezone; //$timezones->id;
|
||||
$version = \Config::get('app.tags');
|
||||
// $version = explode(' ', $version);
|
||||
// $version = $version[1];
|
||||
$system->version = $version;
|
||||
$system->save();
|
||||
|
||||
$admin_tzone = 14;
|
||||
$tzone = Timezones::select('id')->where('name', '=', $timezone)->first();
|
||||
if ($tzone) {
|
||||
$admin_tzone = $tzone->id;
|
||||
}
|
||||
// creating an user
|
||||
$user = User::create([
|
||||
$user = User::updateOrCreate(['id' => 1], [
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'assign_group' => 1,
|
||||
//'assign_group' => 1,
|
||||
'primary_dpt' => 1,
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
]);
|
||||
|
||||
// checking if the user have been created
|
||||
if ($user) {
|
||||
Cache::forever('step6', 'step6');
|
||||
@@ -359,34 +310,20 @@ class InstallController extends Controller
|
||||
{
|
||||
// checking if the installation have been completed or not
|
||||
if (Cache::get('step6') == 'step6') {
|
||||
$value = '1';
|
||||
$install = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
$datacontent = File::get($install);
|
||||
$datacontent = str_replace('%0%', $value, $datacontent);
|
||||
File::put($install, $datacontent);
|
||||
// setting email settings in route
|
||||
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
|
||||
|
||||
$link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$pos = strpos($link, 'final');
|
||||
$link = substr($link, 0, $pos);
|
||||
$app_url = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
$datacontent2 = File::get($app_url);
|
||||
$datacontent2 = str_replace('http://localhost', $link, $datacontent2);
|
||||
File::put($app_url, $datacontent2);
|
||||
$language = Cache::get('language');
|
||||
|
||||
try {
|
||||
Cache::flush();
|
||||
|
||||
Artisan::call('key:generate');
|
||||
\Cache::flush();
|
||||
\Cache::forever('language', $language);
|
||||
$this->updateInstalEnv();
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view6');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('account')->with('fails', $e->getMessage());
|
||||
}
|
||||
} else {
|
||||
$this->updateInstalEnv();
|
||||
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
@@ -400,9 +337,11 @@ class InstallController extends Controller
|
||||
public function finalcheck()
|
||||
{
|
||||
try {
|
||||
$this->updateInstalEnv();
|
||||
|
||||
return redirect('/auth/login');
|
||||
} catch (Exception $e) {
|
||||
return redirect('/auth/login');
|
||||
return redirect('/auth/login')->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,10 +353,16 @@ class InstallController extends Controller
|
||||
if ($f1 >= '644') {
|
||||
return Redirect::back();
|
||||
} else {
|
||||
return Redirect::back()->with('fail_to_change', 'We are unable to change file permission on your server please try to change permission manually.');
|
||||
return Redirect::back()->with(
|
||||
'fail_to_change',
|
||||
'We are unable to change file permission on your server please try to change permission manually.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Redirect::back()->with('fail_to_change', 'We are unable to change file permission on your server please try to change permission manually.');
|
||||
return Redirect::back()->with(
|
||||
'fail_to_change',
|
||||
'We are unable to change file permission on your server please try to change permission manually.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,4 +370,198 @@ class InstallController extends Controller
|
||||
{
|
||||
return view('themes/default1/installer/helpdesk/check-js')->with('url', 'step1');
|
||||
}
|
||||
|
||||
public function createEnv($api = true)
|
||||
{
|
||||
try {
|
||||
if (Input::get('default')) {
|
||||
$default = Input::get('default');
|
||||
} else {
|
||||
$default = Session::get('default');
|
||||
}
|
||||
if (Input::get('host')) {
|
||||
$host = Input::get('host');
|
||||
} else {
|
||||
$host = Session::get('host');
|
||||
}
|
||||
if (Input::get('databasename')) {
|
||||
$database = Input::get('databasename');
|
||||
} else {
|
||||
$database = Session::get('databasename');
|
||||
}
|
||||
if (Input::get('username')) {
|
||||
$dbusername = Input::get('username');
|
||||
} else {
|
||||
$dbusername = Session::get('username');
|
||||
}
|
||||
if (Input::get('password')) {
|
||||
$dbpassword = Input::get('password');
|
||||
} else {
|
||||
$dbpassword = Session::get('password');
|
||||
}
|
||||
if (Input::get('port')) {
|
||||
$port = Input::get('port');
|
||||
} else {
|
||||
$port = Session::get('port');
|
||||
}
|
||||
$this->env($default, $host, $port, $database, $dbusername, $dbpassword);
|
||||
} catch (Exception $ex) {
|
||||
$result = ['error' => $ex->getMessage()];
|
||||
|
||||
return response()->json(compact('result'), 500);
|
||||
}
|
||||
if ($api) {
|
||||
$url = url('preinstall/check');
|
||||
$result = ['success' => 'Environment configuration file has been created successfully', 'next' => 'Running pre migration test', 'api' => $url];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
}
|
||||
|
||||
public function env($default, $host, $port, $database, $dbusername, $dbpassword)
|
||||
{
|
||||
$ENV['APP_DEBUG'] = 'false';
|
||||
$ENV['APP_BUGSNAG'] = 'true';
|
||||
$ENV['APP_URL'] = url('/');
|
||||
$ENV['DB_TYPE'] = $default;
|
||||
$ENV['DB_HOST'] = '"'.$host.'"';
|
||||
$ENV['DB_PORT'] = '"'.$port.'"';
|
||||
$ENV['DB_DATABASE'] = '"'.$database.'"';
|
||||
$ENV['DB_USERNAME'] = '"'.$dbusername.'"';
|
||||
$ENV['DB_PASSWORD'] = '"'.$dbpassword.'"';
|
||||
$ENV['MAIL_DRIVER'] = 'smtp';
|
||||
$ENV['MAIL_HOST'] = 'mailtrap.io';
|
||||
$ENV['MAIL_PORT'] = '2525';
|
||||
$ENV['MAIL_USERNAME'] = 'null';
|
||||
$ENV['MAIL_PASSWORD'] = 'null';
|
||||
$ENV['CACHE_DRIVER'] = 'file';
|
||||
$ENV['SESSION_DRIVER'] = 'file';
|
||||
$ENV['SESSION_COOKIE_NAME'] = 'faveo_'.rand(0, 10000);
|
||||
$ENV['QUEUE_DRIVER'] = 'sync';
|
||||
|
||||
$ENV['FCM_SERVER_KEY'] = 'AIzaSyCyx5OFnsRFUmDLTMbPV50ZMDUGSG-bLw4';
|
||||
$ENV['FCM_SENDER_ID'] = '661051343223';
|
||||
$ENV['REDIS_DATABASE'] = '0';
|
||||
|
||||
$config = '';
|
||||
foreach ($ENV as $key => $val) {
|
||||
$config .= "{$key}={$val}\n";
|
||||
}
|
||||
if (is_file(base_path().DIRECTORY_SEPARATOR.'.env')) {
|
||||
unlink(base_path().DIRECTORY_SEPARATOR.'.env');
|
||||
}
|
||||
if (!is_file(base_path().DIRECTORY_SEPARATOR.'example.env')) {
|
||||
fopen(base_path().DIRECTORY_SEPARATOR.'example.env', 'w');
|
||||
}
|
||||
|
||||
// Write environment file
|
||||
$fp = fopen(base_path().DIRECTORY_SEPARATOR.'example.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
rename(base_path().DIRECTORY_SEPARATOR.'example.env', base_path().DIRECTORY_SEPARATOR.'.env');
|
||||
}
|
||||
|
||||
public function checkPreInstall()
|
||||
{
|
||||
try {
|
||||
$check_for_pre_installation = System::select('id')->first();
|
||||
if ($check_for_pre_installation) {
|
||||
throw new Exception('This database already has tables and data. Please provide fresh database', 100);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
if ($ex->getCode() == 100) {
|
||||
Artisan::call('droptables');
|
||||
$this->createEnv(false);
|
||||
}
|
||||
}
|
||||
Artisan::call('key:generate', ['--force' => true]);
|
||||
|
||||
$url = url('migrate');
|
||||
$result = ['success' => 'Pre migration test has run successfully', 'next' => 'Migrating tables in database', 'api' => $url];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
|
||||
public function migrate()
|
||||
{
|
||||
$db_install_method = '';
|
||||
|
||||
try {
|
||||
$tableNames = \Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
|
||||
if (count($tableNames) === 0) {
|
||||
if (!Cache::get('dummy_data_installation')) {
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
$db_install_method = 'migrate';
|
||||
} else {
|
||||
$path = base_path().DIRECTORY_SEPARATOR.'DB'.DIRECTORY_SEPARATOR.'dummy-data.sql';
|
||||
DB::unprepared(file_get_contents($path));
|
||||
$db_install_method = 'dump';
|
||||
}
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
$this->rollBackMigration();
|
||||
$result = ['error' => $ex->getMessage()];
|
||||
|
||||
return response()->json(compact('result'), 500);
|
||||
}
|
||||
$url = ($db_install_method == 'migrate') ? url('seed') : '';
|
||||
$message = ($db_install_method == 'migrate') ? 'Tables have been migrated successfully in database.' : 'Database has been setup successfully.';
|
||||
$result = ['success' => $message, 'next' => 'Seeding pre configurations data', 'api' => $url];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
|
||||
public function rollBackMigration()
|
||||
{
|
||||
try {
|
||||
Artisan::call('migrate:reset', ['--force' => true]);
|
||||
} catch (Exception $ex) {
|
||||
$result = ['error' => $ex->getMessage()];
|
||||
|
||||
return response()->json(compact('result'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function seed(Request $request)
|
||||
{
|
||||
try {
|
||||
if ($request->input('dummy-data') == 'on') {
|
||||
$path = base_path().'/DB/dummy-data.sql';
|
||||
DB::unprepared(DB::raw(file_get_contents($path)));
|
||||
} else {
|
||||
\Schema::disableForeignKeyConstraints();
|
||||
$tableNames = \Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
|
||||
foreach ($tableNames as $name) {
|
||||
//if you don't want to truncate migrations
|
||||
if ($name == 'migrations') {
|
||||
continue;
|
||||
}
|
||||
DB::table($name)->truncate();
|
||||
}
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
}
|
||||
//$this->updateInstalEnv();
|
||||
} catch (Exception $ex) {
|
||||
$result = ['error' => $ex->getMessage()];
|
||||
|
||||
return response()->json(compact('result'), 500);
|
||||
}
|
||||
$result = ['success' => 'Database has been setup successfully.'];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
|
||||
public function updateInstalEnv()
|
||||
{
|
||||
$env = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
if (is_file($env)) {
|
||||
$txt = 'DB_INSTALL=1';
|
||||
$txt1 = 'APP_ENV=development';
|
||||
file_put_contents($env, $txt.PHP_EOL, FILE_APPEND | LOCK_EX);
|
||||
file_put_contents($env, $txt1, FILE_APPEND | LOCK_EX);
|
||||
} else {
|
||||
throw new Exception('.env not found');
|
||||
}
|
||||
Artisan::call('jwt:secret');
|
||||
}
|
||||
}
|
||||
|
@@ -34,9 +34,11 @@ class Kernel extends HttpKernel
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\App\Http\Middleware\LanguageMiddleware::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
'bindings',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -46,19 +48,23 @@ class Kernel extends HttpKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'roles' => \App\Http\Middleware\CheckRole::class,
|
||||
'role.agent' => \App\Http\Middleware\CheckRoleAgent::class,
|
||||
'role.user' => \App\Http\Middleware\CheckRoleUser::class,
|
||||
'api' => \App\Http\Middleware\ApiKey::class,
|
||||
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
|
||||
'update' => \App\Http\Middleware\CheckUpdate::class,
|
||||
'board' => \App\Http\Middleware\CheckBoard::class,
|
||||
'install' => \App\Http\Middleware\Install::class,
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'roles' => \App\Http\Middleware\CheckRole::class,
|
||||
'role.agent' => \App\Http\Middleware\CheckRoleAgent::class,
|
||||
'role.user' => \App\Http\Middleware\CheckRoleUser::class,
|
||||
'api' => \App\Http\Middleware\ApiKey::class,
|
||||
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
|
||||
'update' => \App\Http\Middleware\CheckUpdate::class,
|
||||
'board' => \App\Http\Middleware\CheckBoard::class,
|
||||
'install' => \App\Http\Middleware\Install::class,
|
||||
'redirect' => \App\Http\Middleware\Redirect::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'installer' => \App\Http\Middleware\IsInstalled::class,
|
||||
'force.option' => \App\Http\Middleware\TicketViewURL::class,
|
||||
];
|
||||
}
|
||||
|
@@ -25,6 +25,6 @@ class CheckRoleAgent
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('dashboard')->with('fails', 'You are not Authorised');
|
||||
return redirect('dashboard')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
}
|
||||
|
32
app/Http/Middleware/IsInstalled.php
Normal file
32
app/Http/Middleware/IsInstalled.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class IsInstalled
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!isInstall()) {
|
||||
return $next($request);
|
||||
} else {
|
||||
if ($request->isJson()) {
|
||||
$url = url('/');
|
||||
$result = ['fails' => 'already installed', 'api' => $url];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} else {
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,20 +4,44 @@ namespace App\Http\Middleware;
|
||||
|
||||
use Cache;
|
||||
use Closure;
|
||||
// use Illuminate\Contracts\Routing\Middleware;
|
||||
use Illuminate\Support\Facades\App;
|
||||
// use Illuminate\Contracts\Routing\Middleware;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Session;
|
||||
|
||||
class LanguageMiddleware
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Cache::has('language') and array_key_exists(Cache::get('language'), Config::get('languages'))) {
|
||||
App::setLocale(Cache::get('language'));
|
||||
$lang = '';
|
||||
if (\Auth::check()) {
|
||||
if (\Auth::user()->user_language != null) {
|
||||
$lang = \Auth::user()->user_language;
|
||||
} else {
|
||||
$lang = $this->getLangFromSessionOrCache();
|
||||
}
|
||||
} else {
|
||||
$lang = $this->getLangFromSessionOrCache();
|
||||
}
|
||||
|
||||
if ($lang != '' and array_key_exists($lang, Config::get('languages'))) {
|
||||
App::setLocale($lang);
|
||||
} else { // This is optional as Laravel will automatically set the fallback language if there is none specified
|
||||
App::setLocale(Config::get('app.fallback_locale'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
public function getLangFromSessionOrCache()
|
||||
{
|
||||
$lang = '';
|
||||
if (Session::has('language')) {
|
||||
$lang = Session::get('language');
|
||||
} elseif (Cache::has('language')) {
|
||||
$lang = Cache::get('language');
|
||||
}
|
||||
|
||||
return $lang;
|
||||
}
|
||||
}
|
||||
|
49
app/Http/Middleware/Redirect.php
Normal file
49
app/Http/Middleware/Redirect.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class Redirect
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$root = $request->root(); //http://localhost/faveo/Faveo-Helpdesk-Pro-fork/public
|
||||
$url = $this->setAppUrl($request);
|
||||
if ($url == $root) {
|
||||
return $next($request);
|
||||
}
|
||||
$seg = '';
|
||||
$segments = $request->segments();
|
||||
if (count($segments) > 0) {
|
||||
foreach ($segments as $segment) {
|
||||
$seg .= '/'.$segment;
|
||||
}
|
||||
}
|
||||
$url = $url.$seg;
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
|
||||
public function setAppUrl($request)
|
||||
{
|
||||
$url = $request->root();
|
||||
if (isInstall()) {
|
||||
$schema = new \App\Model\helpdesk\Settings\CommonSettings();
|
||||
$row = $schema->getOptionValue('url', 'app_url', true);
|
||||
if ($row) {
|
||||
$url = $row->option_value;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
47
app/Http/Middleware/TicketViewURL.php
Normal file
47
app/Http/Middleware/TicketViewURL.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Input;
|
||||
|
||||
//use Redirect;
|
||||
|
||||
class TicketViewURL
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// dd(\Input::all(), $request->fullUrl());
|
||||
$request_str = $request->fullUrl();
|
||||
if (preg_match('([^D]=)', $request_str) == 1) {
|
||||
$request_str = str_replace('=', '%5B%5D=', $request_str);
|
||||
$request_str = str_replace('%5B%5D%5B%5D=', '%5B%5D=', $request_str);
|
||||
}
|
||||
if (count(Input::all()) == 0) {
|
||||
return \Redirect::to('tickets?show%5B%5D=inbox&departments%5B%5D=All');
|
||||
} else {
|
||||
if (!array_key_exists('show', Input::all()) && !array_key_exists('departments', Input::all())) {
|
||||
return \Redirect::to($request_str.'&show%5B%5D=inbox&departments%5B%5D=All');
|
||||
} elseif (!array_key_exists('show', Input::all()) && array_key_exists('departments', Input::all())) {
|
||||
return \Redirect::to($request_str.'&show%5B%5D=inbox');
|
||||
} elseif (array_key_exists('show', Input::all()) && !array_key_exists('departments', Input::all())) {
|
||||
return \Redirect::to($request_str.'&departments%5B%5D=All');
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
if (preg_match('([^D]=)', $request->fullUrl()) == 1) {
|
||||
return \Redirect::to($request_str);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
}
|
@@ -13,8 +13,11 @@ class VerifyCsrfToken extends BaseVerifier
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'CheckSerial',
|
||||
'api/v1/*',
|
||||
'chunk/upload',
|
||||
'chunk/upload/public',
|
||||
'media/files/public',
|
||||
'media/files',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
@@ -21,7 +20,6 @@ class AgentLayout
|
||||
protected $users;
|
||||
protected $tickets;
|
||||
protected $department;
|
||||
protected $emails;
|
||||
|
||||
/**
|
||||
* Create a new profile composer.
|
||||
@@ -30,14 +28,13 @@ class AgentLayout
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Company $company, User $users, Tickets $tickets, Department $department, Emails $emails)
|
||||
public function __construct(Company $company, User $users, Tickets $tickets, Department $department)
|
||||
{
|
||||
$this->company = $company;
|
||||
$this->auth = Auth::user();
|
||||
$this->users = $users;
|
||||
$this->tickets = $tickets;
|
||||
$this->department = $department;
|
||||
$this->emails = $emails;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,19 +48,16 @@ class AgentLayout
|
||||
{
|
||||
$notifications = \App\Http\Controllers\Common\NotificationController::getNotifications();
|
||||
$view->with([
|
||||
'company' => $this->company,
|
||||
'notifications' => $notifications,
|
||||
'myticket' => $this->myTicket(),
|
||||
'unassigned' => $this->unassigned(),
|
||||
'followup_ticket' => $this->followupTicket(),
|
||||
'deleted' => $this->deleted(),
|
||||
'closed' => $this->closed(),
|
||||
'tickets' => $this->inbox(),
|
||||
'department' => $this->departments(),
|
||||
'overdues' => $this->overdues(),
|
||||
'due_today' => $this->getDueToday(),
|
||||
'is_mail_conigured' => $this->getEmailConfig(),
|
||||
'ticket_policy' => new \App\Policies\TicketPolicy(),
|
||||
'company' => $this->company,
|
||||
'notifications' => $notifications,
|
||||
'myticket' => $this->myTicket(),
|
||||
'unassigned' => $this->unassigned(),
|
||||
'followup_ticket' => $this->followupTicket(),
|
||||
'deleted' => $this->deleted(),
|
||||
'tickets' => $this->inbox(),
|
||||
'department' => $this->departments(),
|
||||
'overdues' => $this->overdues(),
|
||||
'due_today' => $this->getDueToday(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -104,10 +98,10 @@ class AgentLayout
|
||||
$ticket = $this->tickets();
|
||||
if ($this->auth->role == 'admin') {
|
||||
return $ticket->where('assigned_to', $this->auth->id)
|
||||
->where('status', '1');
|
||||
->where('status', '1');
|
||||
} elseif ($this->auth->role == 'agent') {
|
||||
return $ticket->where('assigned_to', $this->auth->id)
|
||||
->where('status', '1');
|
||||
->where('status', '1');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,13 +110,13 @@ class AgentLayout
|
||||
$ticket = $this->tickets();
|
||||
if ($this->auth->role == 'admin') {
|
||||
return $ticket->where('assigned_to', '=', null)
|
||||
->where('status', '=', '1')
|
||||
->select('id');
|
||||
->where('status', '=', '1')
|
||||
->select('id');
|
||||
} elseif ($this->auth->role == 'agent') {
|
||||
return $ticket->where('assigned_to', '=', null)
|
||||
->where('status', '=', '1')
|
||||
->where('dept_id', '=', $this->auth->primary_dpt)
|
||||
->select('id');
|
||||
->where('status', '=', '1')
|
||||
->where('dept_id', '=', $this->auth->primary_dpt)
|
||||
->select('id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +137,7 @@ class AgentLayout
|
||||
return $ticket->where('status', '5')->select('id');
|
||||
} elseif ($this->auth->role == 'agent') {
|
||||
return $ticket->where('status', '5')->where('dept_id', '=', $this->auth->primary_dpt)
|
||||
->select('id');
|
||||
->select('id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +151,7 @@ class AgentLayout
|
||||
|
||||
return $table->Join('ticket_status', function ($join) {
|
||||
$join->on('ticket_status.id', '=', 'tickets.status')
|
||||
->whereIn('ticket_status.id', [1, 7]);
|
||||
->whereIn('ticket_status.id', [1, 7]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -200,45 +194,4 @@ class AgentLayout
|
||||
->whereRaw('date(duedate) = ?', [date('Y-m-d')]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @category function to fetch closed tickets count
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return builder
|
||||
*/
|
||||
public function closed()
|
||||
{
|
||||
$table = $this->tickets();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
$id = Auth::user()->id;
|
||||
$dept = DepartmentAssignAgents::where('agent_id', '=', $id)->pluck('department_id')->toArray();
|
||||
$table = $table->whereIn('tickets.dept_id', $dept)->orWhere('assigned_to', '=', Auth::user()->id);
|
||||
|
||||
// $id = Auth::user()->primary_dpt;
|
||||
// $table = $table->where('tickets.dept_id', '=', $id)->orWhere('assigned_to', '=', Auth::user()->id);
|
||||
}
|
||||
|
||||
return $table->where('status', 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category function to check configured mails
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @var $emails
|
||||
*
|
||||
* @return bool true/false
|
||||
*/
|
||||
public function getEmailConfig()
|
||||
{
|
||||
$emails = $this->emails->where('sending_status', '=', 1)->where('fetching_status', '=', 1)->count();
|
||||
if ($emails >= 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class AuthUser
|
||||
'auth_name' => $this->user->name(),
|
||||
'auth_user_active' => $this->user->active,
|
||||
'auth_user_primary_dept'=> $this->user->primary_dept,
|
||||
'auth_user_assign_group'=> '', //$this->user->assign_group,
|
||||
'auth_user_assign_group'=> $this->user->assign_group,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
109
public/probe.php
Normal file
109
public/probe.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
error_reporting();
|
||||
|
||||
$extensions = [
|
||||
'curl',
|
||||
'ctype',
|
||||
'imap',
|
||||
'mbstring',
|
||||
// 'mcrypt',
|
||||
'openssl',
|
||||
'tokenizer',
|
||||
'zip',
|
||||
'pdo',
|
||||
'mysqli',
|
||||
'bcmath',
|
||||
'iconv',
|
||||
'XML', //for HTML email processing
|
||||
'json',
|
||||
'fileinfo',
|
||||
//'ioncube_loader_dar_5.6',
|
||||
];
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
table {
|
||||
width:100%;
|
||||
}
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
table.t01 tr:nth-child(even) {
|
||||
background-color: #eee;
|
||||
}
|
||||
table.t01 tr:nth-child(odd) {
|
||||
background-color:#fff;
|
||||
}
|
||||
table.t01 th {
|
||||
background-color: #9DD1DE;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="height: auto; width: 500; margin: auto;">
|
||||
<h1 style="text-align: center; color: #9DD1DE">FAVEO PROBE</h1>
|
||||
<table class="t01">
|
||||
<tr>
|
||||
<th>Requirements</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<?php
|
||||
echo '<tr>';
|
||||
if (version_compare(phpversion(), '7.1.9', '>=') == 1) {
|
||||
echo "<td>PHP Version</td> <td style='color:green'>".phpversion().'</td>';
|
||||
} else {
|
||||
echo "<td>PHP Version</td> <td style='color:red'>".phpversion().'<p>Please upgrade PHP Version to 7.1.3 or greater version </p></td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
$env = '../.env';
|
||||
if (!is_file($env)) {
|
||||
echo "<td>.env file</td> <td style='color:green'>Not found</td>";
|
||||
} else {
|
||||
echo "<td>.env file</td> <td style='color:red'>Yes Found<p>Please delete '$env' </p></td>";
|
||||
}
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
$redirect = in_array('mod_rewrite', apache_get_modules());
|
||||
if ($redirect) {
|
||||
echo "<td>Rewrite Engine (User friendly URL)</td> <td style='color:green'>ON</td>";
|
||||
} else {
|
||||
echo "<td>Rewrite Engine (User friendly URL)</td> <td style='color:red'>OFF</td>";
|
||||
}
|
||||
echo '</tr>';
|
||||
?>
|
||||
</table>
|
||||
<br/>
|
||||
<table class="t01">
|
||||
<tr>
|
||||
<th>PHP Extensions</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($extensions as $extension) {
|
||||
echo '<tr>';
|
||||
if (!extension_loaded($extension)) {
|
||||
echo '<td>'.$extension."</td> <td style='color:red'>Not Enabled"
|
||||
."<p>To enable this, please open '".php_ini_loaded_file()."' and add 'extension = ".$extension."'</p>"
|
||||
.'</td>';
|
||||
} else {
|
||||
echo '<td>'.$extension."</td> <td style='color:green'>Enabled</td>";
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<p style='color:red;'>NOTE: Please delete the file 'probe.php' once you have fixed all the issues.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@@ -9,7 +9,7 @@ active
|
||||
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<center id="fail" style="font-size: 1.3em">JavaScript Disabled!</center>
|
||||
<p style="font-size:1.0em">Hello, Sparky! You are just a few steps away from your support system. It looks like that JavaScript is disabled in your browser or not supported by your browser. FAVEO doesn't work properly without JavaScript, and it may cause errors in installation. Please check and enable JavaScript in your browser in order to install and run FAVEO to its full extent.</p>
|
||||
<p style="font-size:1.0em">Hello, Sparky! You are just a few steps away from your support system. It looks like that JavaScript is not supported or disabled in your browser. FAVEO doesn't work properly without JavaScript, and it may cause errors in installation process. Please check and enable JavaScript in your browser in order to install and run FAVEO to its full extent.</p>
|
||||
<p class="wc-setup-actions step">
|
||||
Have you enabled JavaScript?
|
||||
<a href="{!! $url !!}">Click here</a> to reload the page now.
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,9 +1,5 @@
|
||||
@extends('themes.default1.installer.layout.installer')
|
||||
|
||||
@section('license')
|
||||
done
|
||||
@stop
|
||||
|
||||
@section('environment')
|
||||
active
|
||||
@stop
|
||||
@@ -11,7 +7,13 @@ active
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<div id="no-js">
|
||||
<noscript>
|
||||
<meta http-equiv="refresh" content="0; URL=JavaScript-disabled">
|
||||
<style type="text/css">#form-content {display: none;}</style>
|
||||
</noscript>
|
||||
</div>
|
||||
|
||||
<div id="form-content">
|
||||
<center><h1>Environment Test</h1></center>
|
||||
@if (Session::has('fail_to_change'))
|
||||
@@ -53,8 +55,8 @@ class TestResult {
|
||||
<?php
|
||||
|
||||
function validate_php(&$results) {
|
||||
if (version_compare(PHP_VERSION, '5.5') == -1) {
|
||||
$results[] = new TestResult('Minimum PHP version required in order to run Faveo HELPDESK is PHP 5.5. Your PHP version: ' . PHP_VERSION, STATUS_ERROR);
|
||||
if (version_compare(PHP_VERSION, '7.1.3') == -1) {
|
||||
$results[] = new TestResult('PHP version required in order to run Faveo HELPDESK is PHP 7.1.3 or greater. Your PHP version: ' . PHP_VERSION, STATUS_ERROR);
|
||||
return false;
|
||||
} else {
|
||||
$results[] = new TestResult('Your PHP version is ' . PHP_VERSION, STATUS_OK);
|
||||
@@ -74,6 +76,7 @@ function validate_php(&$results) {
|
||||
function php_config_value_to_bytes($val) {
|
||||
$val = trim($val);
|
||||
$last = strtolower($val{strlen($val) - 1});
|
||||
$val = (integer)$val;
|
||||
switch ($last) {
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
@@ -178,7 +181,9 @@ function validate_zend_compatibility_mode(&$results) {
|
||||
function validate_extensions(&$results) {
|
||||
$ok = true;
|
||||
|
||||
$required_extensions = array('mcrypt', 'openssl', 'pdo', 'fileinfo', 'curl', 'zip', 'mbstring');
|
||||
$required_extensions = ['curl', 'ctype', 'imap', 'mbstring',
|
||||
'openssl', 'tokenizer', 'zip', 'pdo', 'mysqli', 'bcmath',
|
||||
'iconv', 'xml', 'json'];
|
||||
|
||||
foreach ($required_extensions as $required_extension) {
|
||||
if (extension_loaded($required_extension)) {
|
||||
@@ -202,7 +207,8 @@ function validate_extensions(&$results) {
|
||||
} // if
|
||||
|
||||
$recommended_extensions = array(
|
||||
'imap' => 'IMAP extension is used for connecting to mail server using IMAP settings to fetch emails in the system.'
|
||||
// 'imap' => 'IMAP extension is used for connecting to mail server using IMAP settings to fetch emails in the system.',
|
||||
// 'mcrypt' => 'Optional extension',
|
||||
// 'gd' => 'GD is used for image manipulation. Without it, system is not able to create thumbnails for files or manage avatars, logos and project icons. Please refer to <a href="http://www.php.net/manual/en/image.installation.php">this</a> page for installation instructions',
|
||||
// 'mbstring' => 'MultiByte String is used for work with Unicode. Without it, system may not split words and string properly and you can have weird question mark characters in Recent Activities for example. Please refer to <a href="http://www.php.net/manual/en/mbstring.installation.php">this</a> page for installation instructions',
|
||||
// 'curl' => 'cURL is used to support various network tasks. Please refer to <a href="http://www.php.net/manual/en/curl.installation.php">this</a> page for installation instructions',
|
||||
@@ -257,6 +263,7 @@ function checkMaxExecutiontime(&$results)
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Do the magic
|
||||
// ---------------------------------------------------
|
||||
@@ -288,7 +295,7 @@ if ($php_ok && $memory_ok && $extensions_ok && $file_permission && $required_fun
|
||||
|
||||
|
||||
<form action="{{URL::route('postprerequisites')}}" method="post" class="border-line">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
{{ csrf_field() }}
|
||||
<p class="setup-actions step">
|
||||
<input type="submit" id="submitme" class="button-primary button button-large button-next" value="Continue">
|
||||
<a href="{!! route('licence') !!}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
@@ -319,4 +326,4 @@ if ($php_ok && $memory_ok && $extensions_ok && $file_permission && $required_fun
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@stop
|
||||
|
@@ -53,7 +53,7 @@ active
|
||||
<td>
|
||||
<div class="side-by-side clearfix moveleftthre">
|
||||
<div>
|
||||
<select name="default" data-placeholder="Choose a SQL format..." class="chosen-select" style="width:290px;" tabindex="2">
|
||||
<select name="default" data-placeholder="Choose a SQL format..." class="chosen-select" style="width:288px;" tabindex="2">
|
||||
<option value="mysql">MySQL</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -126,9 +126,15 @@ active
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<p ng-controller="MainController">
|
||||
<input id="dummy-data" class="input-checkbox" type="checkbox" name="dummy-data">
|
||||
<label for="dummy-data" style="color:#3AA7D9">Install dummy data</label>
|
||||
<button type="button" data-toggle="popover" data-placement="right" data-arrowcolor="#eeeeee" data-bordercolor="#bbbbbb" data-title-backcolor="#cccccc" data-title-bordercolor="#bbbbbb" data-title-textcolor="#444444" data-content-backcolor="#eeeeee" data-content-textcolor="#888888" title="@{{DummyDataTitle}}" data-content="@{{DummyDataContent}}" style="padding: 0px;border: 0px; border-radius: 5px;"><i class="fa fa-question-circle" style="padding: 0px;"></i>
|
||||
</button>
|
||||
</p>
|
||||
<p class="setup-actions step">
|
||||
<input type="submit" id="submitme" class="button-primary button button-large button-next" value="Continue">
|
||||
<a href="{!! route('prerequisites') !!}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
<a href="{!! route('licence') !!}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
</p>
|
||||
<br>
|
||||
</form>
|
||||
@@ -169,16 +175,22 @@ active
|
||||
@endif
|
||||
|
||||
$('#databaseform').on('submit', function(e){
|
||||
var empty_field = 0;
|
||||
$("#databaseform input[type=text]").each(function(){
|
||||
if($(this).attr('name') == 'host' || $(this).attr('name') == 'databasename' || $(this).attr('name') == 'username'){
|
||||
if ($(this).val() == '') {
|
||||
$(this).css('border-color','red')
|
||||
$(this).css('border-width','1px');
|
||||
e.preventDefault();
|
||||
alert('Please fill all required values.');
|
||||
empty_field = 1;
|
||||
} else {
|
||||
empty_field = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (empty_field != 0) {
|
||||
e.preventDefault();
|
||||
alert('Please fill all required values.');
|
||||
}
|
||||
});
|
||||
|
||||
$('input[type=text]').on('blur', function(){
|
||||
|
@@ -14,8 +14,8 @@ active
|
||||
|
||||
@section('content')
|
||||
|
||||
<h1 style="text-align: center;">Database Setup</h1>
|
||||
This test will check prerequisites required to install Faveo<br/>
|
||||
<h1 style="text-align: center;">Database Setup</h1>
|
||||
This test will check prerequisites required to install Faveo<br/>
|
||||
<?php
|
||||
/**
|
||||
* Faveo HELPDESK Probe
|
||||
@@ -29,6 +29,7 @@ $host = Session::get('host');
|
||||
$username = Session::get('username');
|
||||
$password = Session::get('password');
|
||||
$databasename = Session::get('databasename');
|
||||
$dummy_install = Session::get('dummy_data_installation');
|
||||
$port = Session::get('port');
|
||||
define('DB_HOST', $host); // Address of your MySQL server (usually localhost)
|
||||
define('DB_USER', $username); // Username that is used to connect to the server
|
||||
@@ -40,23 +41,34 @@ define('PROBE_FOR', '<b>Faveo</b> HELPDESK 1.0 and Newer');
|
||||
define('STATUS_OK', 'Ok');
|
||||
define('STATUS_WARNING', 'Warning');
|
||||
define('STATUS_ERROR', 'Error');
|
||||
|
||||
class TestResult {
|
||||
|
||||
var $message;
|
||||
var $status;
|
||||
|
||||
function __construct($message, $status = STATUS_OK) {
|
||||
$this->message = $message;
|
||||
$this->status = $status;
|
||||
}
|
||||
} // TestResult
|
||||
|
||||
}
|
||||
|
||||
// TestResult
|
||||
if (DB_HOST && DB_USER && DB_NAME) {
|
||||
?>
|
||||
<?php
|
||||
<?php
|
||||
$mysqli_ok = true;
|
||||
$results = array();
|
||||
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
||||
error_reporting(0);
|
||||
if($default == 'mysql') {
|
||||
if ($connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME)) {
|
||||
if ($default == 'mysql') {
|
||||
if(DB_PORT != '' && is_numeric(DB_PORT)) {
|
||||
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT);
|
||||
} else {
|
||||
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
}
|
||||
if ($connection) {
|
||||
$results[] = new TestResult('Connected to database as ' . DB_USER . '@' . DB_HOST . DB_PORT, STATUS_OK);
|
||||
if (mysqli_select_db($connection, DB_NAME)) {
|
||||
$results[] = new TestResult('Database "' . DB_NAME . '" selected', STATUS_OK);
|
||||
@@ -64,7 +76,7 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
if (version_compare($mysqli_version, '5') >= 0) {
|
||||
$results[] = new TestResult('MySQL version is ' . $mysqli_version, STATUS_OK);
|
||||
// $have_inno = check_have_inno($connection);
|
||||
$sql = "SHOW TABLES FROM ".DB_NAME;
|
||||
$sql = "SHOW TABLES FROM " . DB_NAME;
|
||||
$res = mysqli_query($connection, $sql);
|
||||
if (mysqli_fetch_array($res) === null) {
|
||||
$results[] = new TestResult('Database is empty');
|
||||
@@ -78,14 +90,14 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
$mysqli_ok = false;
|
||||
} // if
|
||||
} else {
|
||||
$results[] = new TestResult('Failed to select database. ' . mysqli_error(), STATUS_ERROR);
|
||||
$results[] = new TestResult('Failed to select database. ' . mysqli_connect_error(), STATUS_ERROR);
|
||||
$mysqli_ok = false;
|
||||
} // if
|
||||
} else {
|
||||
$results[] = new TestResult('Failed to connect to database. ' . mysqli_error(), STATUS_ERROR);
|
||||
$results[] = new TestResult('Failed to connect to database. ' . mysqli_connect_error(), STATUS_ERROR);
|
||||
$mysqli_ok = false;
|
||||
} // if
|
||||
}
|
||||
}
|
||||
// elseif($default == 'pgsql') {
|
||||
// if ($connection2 = pg_connect("'host='.DB_HOST.' port='.DB_PORT.' dbname='.DB_NAME.' user='.DB_USER.' password='.DB_PASS.")) {
|
||||
// $results[] = new TestResult('Connected to database as ' . DB_USER . '@' . DB_HOST, STATUS_OK);
|
||||
@@ -94,7 +106,6 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
// $mysqli_ok = false;
|
||||
// }
|
||||
// } elseif($default == 'sqlsrv') {
|
||||
|
||||
// }
|
||||
// ---------------------------------------------------
|
||||
// Validators
|
||||
@@ -105,105 +116,180 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
print '<br><span class="' . strtolower($result->status) . '">' . $result->status . '</span> — ' . $result->message . '';
|
||||
} // foreach
|
||||
?> </p>
|
||||
<!-- </ul> -->
|
||||
<!-- </ul> -->
|
||||
<?php } else { ?>
|
||||
<p>Database test is <strong>turned off</strong>. To turn it On, please open probe.php in your favorite text editor and set DB_XXXX connection parameters in database section at the beginning of the file:</p>
|
||||
<ul>
|
||||
<li>DB_HOST — Address of your MySQL server (usually localhost)</li>
|
||||
<li>DB_USER — Username that is used to connect to the server</li>
|
||||
<li>DB_PASS — User's password</li>
|
||||
<li>DB_NAME — Name of the database you are connecting to</li>
|
||||
</ul>
|
||||
<p>Once these settings are set, probe.php will check if your database meets the system requirements.</p>
|
||||
<?php $mysqli_ok = null;?>
|
||||
<?php } ?>
|
||||
<br/>
|
||||
<ul>
|
||||
<li><p>Unable to test database connection. Please make sure your database server is up and running and PHP is working with session.</p></li>
|
||||
</ul>
|
||||
<p>If you have fixed all the errors. <a href="{{ URL::route('configuration') }}">Click here</a> to continue the installation process.</p>
|
||||
<?php $mysqli_ok = null; ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($mysqli_ok !== null) {?>
|
||||
<?php if ($mysqli_ok) {?>
|
||||
<?php if ($mysqli_ok !== null) { ?>
|
||||
<?php if ($mysqli_ok) { ?>
|
||||
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<p id="pass">Database connection successful. This system can run Faveo</p>
|
||||
</div>
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<p id="pass">Database connection successful. This system can run Faveo</p>
|
||||
</div>
|
||||
|
||||
<script src="{{asset("lb-faveo/js/ajax-jquery.min.js")}}"></script>
|
||||
<script src="{{asset("lb-faveo/js/ajax-jquery.min.js")}}"></script>
|
||||
|
||||
<span id="wait">Please wait this may take a while......</span>
|
||||
<span id="wait"></span>
|
||||
|
||||
{!! Form::open( ['id'=>'form','method' => 'POST'] )!!}
|
||||
{{-- <input type="hidden" name="_token" value="{{ csrf_token() }}"> --}}
|
||||
<!-- <b>default</b><br> -->
|
||||
<input type="hidden" name="default" value="{!! $default !!}"/>
|
||||
<!-- <b>Host</b><br> -->
|
||||
<input type="hidden" name="host" value="{!! $host !!}"/>
|
||||
<!-- <b>Database Name</b><br> -->
|
||||
<input type="hidden" name="databasename" value="{!! $databasename !!}"/>
|
||||
<!-- <b>User Name</b><br> -->
|
||||
<input type="hidden" name="username" value="{!! $username !!}"/>
|
||||
<!-- <b>User Password</b><br> -->
|
||||
<input type="hidden" name="password" value="{!! $password !!}"/>
|
||||
<!-- <b>Port</b><br> -->
|
||||
<input type="hidden" name="port" value="{!! $port !!}"/>
|
||||
{!! Form::open( ['id'=>'form','method' => 'POST'] )!!}
|
||||
{{-- <input type="hidden" name="_token" value="{{ csrf_token() }}"> --}}
|
||||
<!-- <b>default</b><br> -->
|
||||
<input type="hidden" name="default" value="{!! $default !!}"/>
|
||||
<!-- <b>Host</b><br> -->
|
||||
<input type="hidden" name="host" value="{!! $host !!}"/>
|
||||
<!-- <b>Database Name</b><br> -->
|
||||
<input type="hidden" name="databasename" value="{!! $databasename !!}"/>
|
||||
<!-- <b>User Name</b><br> -->
|
||||
<input type="hidden" name="username" value="{!! $username !!}"/>
|
||||
<!-- <b>User Password</b><br> -->
|
||||
<input type="hidden" name="password" value="{!! $password !!}"/>
|
||||
<!-- <b>Port</b><br> -->
|
||||
<input type="hidden" name="port" value="{!! $port !!}"/>
|
||||
<!-- Dummy data installation -->
|
||||
<input type="hidden" name="dummy_install" value="{!! $dummy_install !!}"/>
|
||||
|
||||
<input type="submit" style="display:none;">
|
||||
<input type="submit" style="display:none;">
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<div id="show" style="display:none;">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
|
||||
<div id="show" style="display:none;">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-9" style="text-align: center"id='loader' >
|
||||
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
<p class="setup-actions step">
|
||||
<a href="{{ URL::route('account') }}" class="pull-right" id="next" style="text-color:black"><input type="submit" id="submitme" class="button-primary button button-large button-next" value="Continue"> </a>
|
||||
<a href="{{ URL::route('configuration') }}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
<p class="setup-actions step" id="retry">
|
||||
<a href="{{ URL::route('account') }}" class="pull-right" id="next" style="text-color:black"><input type="submit" id="submitme" class="button-primary button button-large button-next" value="Continue"> </a>
|
||||
<a href="{{ URL::route('configuration') }}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<script type="text/javascript">
|
||||
// submit a ticket
|
||||
$(document).ready(function () {
|
||||
$("#form").submit();
|
||||
});
|
||||
// Edit a ticket
|
||||
$('#form').on('submit', function() {
|
||||
<script type="text/javascript">
|
||||
// submit a ticket
|
||||
$(document).ready(function () {
|
||||
$("#form").submit();
|
||||
});
|
||||
// Edit a ticket
|
||||
$('#form').on('submit', function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{!! route('postconnection') !!}",
|
||||
dataType: "html",
|
||||
type: "GET",
|
||||
url: "{!! url('create/env') !!}",
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
beforeSend: function() {
|
||||
beforeSend: function () {
|
||||
$("#conn").hide();
|
||||
$("#show").show();
|
||||
$("#wait").show();
|
||||
},
|
||||
success: function(response) {
|
||||
// $("#dismis").trigger("click");
|
||||
if (response == 1) {
|
||||
$("#show").hide();
|
||||
$("#wait").hide();
|
||||
$("#conn").show();
|
||||
// $("#next1").trigger("click");
|
||||
} else if (response == 0) {
|
||||
alert('Please check all your fields');
|
||||
}
|
||||
success: function (response) {
|
||||
var data=response.result;
|
||||
console.log(data);
|
||||
var message = data.success;
|
||||
var next = data.next;
|
||||
var api = data.api;
|
||||
$('#submitme').attr('disabled','disabled');
|
||||
$('#wait').append('<ul><li>'+message+'</li><li class="seco">'+next+'...</li></ul>');
|
||||
callApi(api);
|
||||
},
|
||||
error: function(response){
|
||||
var data=response.responseJSON.result;
|
||||
$('#wait').append('<ul><li style="color:red">'+data.error+'</li></ul>');
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').hide();
|
||||
$('#retry').append('<input type="button" id="submitm" class="button-primary button button-large button-next" value="Retry" onclick="reload()">');
|
||||
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
function callApi(api) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: api,
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
success: function (response) {
|
||||
var data=response.result;
|
||||
console.log(data);
|
||||
var message = data.success;
|
||||
var next = data.next;
|
||||
var api = data.api;
|
||||
$("#wait").find('.seco').remove();
|
||||
$('#wait ul').append('<li>'+message+'</li><li class="seco">'+next+'...</li>');
|
||||
if (message == 'Database has been setup successfully.') {
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').show();
|
||||
$('#submitme').removeAttr('disabled');
|
||||
$('.seco').hide();
|
||||
} else {
|
||||
callApi(api);
|
||||
}
|
||||
},
|
||||
error: function(response){
|
||||
console.log(response);
|
||||
var data=response.responseJSON.result;
|
||||
$('#seco').append('<p style="color:red">'+data.error+'</p>');
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').hide();
|
||||
$('#retry').append('<input type="button" id="submitm" class="button-primary button button-large button-next" value="Retry" onclick="reload()">');
|
||||
}
|
||||
});
|
||||
}
|
||||
function reload(){
|
||||
$('#retry').find('#submitm').remove();
|
||||
$('#loader').show();
|
||||
$('#wait').find('ol').remove();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{!! url('create/env') !!}",
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
beforeSend: function () {
|
||||
$("#conn").hide();
|
||||
$("#show").show();
|
||||
$("#wait").show();
|
||||
},
|
||||
success: function (response) {
|
||||
var data=response.result;
|
||||
console.log(data);
|
||||
var message = data.success;
|
||||
var next = data.next;
|
||||
var api = data.api;
|
||||
$('#submitme').attr('disabled','disabled');
|
||||
$('#wait').append('<ul><li>'+message+'</li><li class="seco">'+next+'...</li></ul>');
|
||||
callApi(api);
|
||||
},
|
||||
error: function(response){
|
||||
var data=response.responseJSON.result;
|
||||
$('#wait').append('<ul><li style="color:red">'+data.error+'</li></ul>');
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').hide();
|
||||
$('#retry').append('<input type="button" id="submitm" class="button-primary button button-large button-next" value="Retry" onclick="reload()">');
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php } else { ?>
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<p id="fail">Database connection unsuccessful. This system does not meet Faveo system requirements</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>This either means that the username and password information is incorrect or we can’t contact the database server. This could mean your host’s database server is down.</p>
|
||||
<ul>
|
||||
<li>Are you sure you have the correct username and password?</li>
|
||||
@@ -213,15 +299,15 @@ $(document).ready(function () {
|
||||
<p>If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="http://www.ladybirdweb.com/support">Faveo Support </a>.</p>
|
||||
|
||||
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
@if(Cache::has('step4')) <?php Cache::forget('step4')?> @endif
|
||||
<p class="setup-actions step">
|
||||
<input type="submit" id="submitme" class="button-danger button button-large button-next" style="background-color: #d43f3a;color:#fff;" value="continue" disabled>
|
||||
<a href="{{URL::route('configuration')}}" class="button button-large button-next" style="float: left;">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
<br/><br/>
|
||||
<?php } // if ?>
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
@if(Cache::has('step4')) <?php Cache::forget('step4') ?> @endif
|
||||
<p class="setup-actions step">
|
||||
<input type="button" id="submitme" class="button-danger button button-large button-next" style="background-color: #d43f3a;color:#fff;" value="continue" disabled>
|
||||
<a href="{{URL::route('configuration')}}" class="button button-large button-next" style="float: left;">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
<br/><br/>
|
||||
<?php } // if ?>
|
||||
<div id="legend">
|
||||
{{-- <ul> --}}
|
||||
<p class="setup-actions step">
|
||||
@@ -231,6 +317,6 @@ $(document).ready(function () {
|
||||
</p>
|
||||
{{-- </ul> --}}
|
||||
</div>
|
||||
<?php } // if ?>
|
||||
<?php } // if ?>
|
||||
|
||||
@stop
|
@@ -24,7 +24,7 @@ active
|
||||
|
||||
|
||||
<!-- checking if the form submit fails -->
|
||||
@if($errors->first('firstname')||$errors->first('Lastname')||$errors->first('email')||$errors->first('username')||$errors->first('password')||$errors->first('confirmpassword'))
|
||||
@if($errors->first('firstname')||$errors->first('Lastname')||$errors->first('email')||$errors->first('username')||$errors->first('password')||$errors->first('confirm_password'))
|
||||
<div class="woocommerce-message woocommerce-tracker">
|
||||
<div class="fail">
|
||||
@if($errors->first('firstname'))
|
||||
@@ -42,8 +42,8 @@ active
|
||||
@if($errors->first('password'))
|
||||
<span id="fail">{!! $errors->first('password', ':message') !!}</span><br/>
|
||||
@endif
|
||||
@if($errors->first('confirmpassword'))
|
||||
<span id="fail">{!! $errors->first('confirmpassword', ':message') !!}</span><br/><br/>
|
||||
@if($errors->first('confirm_password'))
|
||||
<span id="fail">{!! $errors->first('confirm_password', ':message') !!}</span><br/><br/>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@@ -319,7 +319,7 @@ active
|
||||
?>
|
||||
<select name="language" data-placeholder="Choose a timezone..." class="chosen-select" style="width:295px;" tabindex="2">
|
||||
@foreach($values as $value)
|
||||
<option value="{!! $value !!}">{!! Config::get('languages.' . $value) !!}</option>
|
||||
<option value="{!! $value !!}">{!! Config::get('languages.' . $value)[0] !!} ({!! Config::get('languages.' . $value)[1] !!})</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@@ -331,10 +331,6 @@ active
|
||||
</tr>
|
||||
</div>
|
||||
</table>
|
||||
<input id="dummy-data" class="input-checkbox" type="checkbox" name="dummy-data">
|
||||
<label for="dummy-data" style="color:#3AA7D9">Install dummy data</label>
|
||||
<button type="button" data-toggle="popover" data-placement="right" data-arrowcolor="#eeeeee" data-bordercolor="#bbbbbb" data-title-backcolor="#cccccc" data-title-bordercolor="#bbbbbb" data-title-textcolor="#444444" data-content-backcolor="#eeeeee" data-content-textcolor="#888888" title="@{{DummyDataTitle}}" data-content="@{{DummyDataContent}}" style="padding: 0px;border: 0px; border-radius: 5px;"><i class="fa fa-question-circle" style="padding: 0px;"></i>
|
||||
</button>
|
||||
<br><br>
|
||||
<p class="setup-actions step">
|
||||
<input type="submit" id="submitme" class="button-primary button button-large button-next" value="Install">
|
||||
@@ -352,7 +348,7 @@ active
|
||||
@if($errors->has('firstname'))
|
||||
addErrorClass('firstname');
|
||||
@endif
|
||||
@if($errors->has('Lastname'))
|
||||
@if($errors->has('lastname'))
|
||||
addErrorClass('Lastname');
|
||||
@endif
|
||||
@if($errors->has('email'))
|
||||
@@ -369,7 +365,10 @@ active
|
||||
@endif
|
||||
|
||||
$('#postaccount').on('submit', function(e) {
|
||||
$("#postaccount input").each(function(){
|
||||
$('#submitme').attr('disabled', true);
|
||||
$('#submitme').val('Installing, please wait...');
|
||||
$empty_field = 0;
|
||||
$("#postaccount input").each(function() {
|
||||
if($(this).attr('name') == 'firstname' ||
|
||||
$(this).attr('name') == 'Lastname' ||
|
||||
$(this).attr('name') == 'email' ||
|
||||
@@ -379,13 +378,18 @@ active
|
||||
if ($(this).val() == '') {
|
||||
$(this).css('border-color','red')
|
||||
$(this).css('border-width','1px');
|
||||
e.preventDefault();
|
||||
$empty_field = 1;
|
||||
} else {
|
||||
$empty_field = 0;
|
||||
}
|
||||
} else {
|
||||
$('#submitme').attr('disabled', true);
|
||||
$('#submitme').val('Installing, please wait...');
|
||||
}
|
||||
});
|
||||
if ($empty_field !=0 ) {
|
||||
alert('Please fill all required values.');
|
||||
e.preventDefault();
|
||||
$('#submitme').attr('disabled', false);
|
||||
$('#submitme').val('Install');
|
||||
}
|
||||
});
|
||||
|
||||
$('input').on('focus', function(){
|
||||
|
@@ -26,30 +26,40 @@ active
|
||||
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQ-uhinU3OzXKj9zlFO7dFxHaChqyHPcWWg5nWgMqYt6N5b3knK" style="width: 86px; float: right;">
|
||||
</a>
|
||||
|
||||
<h1 style="text-align: center;">Your Helpdesk is Ready!</h1>
|
||||
<h1 style="text-align: center;">{!! Lang::get('lang.your_helpdesk_is_ready') !!}</h1>
|
||||
<div class="woocommerce-message woocommerce-tracker">
|
||||
<p>All right, sparky! You’ve made it through the installation.</p>
|
||||
<p>{!! Lang::get('lang.all_right_sparky_you_have_made_it') !!}</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="setup-next-steps">
|
||||
<div class="setup-next-steps-first">
|
||||
<h2>Next Steps</h2>
|
||||
<h2>{!! Lang::get('lang.next_step') !!}</h2>
|
||||
<ul>
|
||||
<li class="setup-product"><a class="button button-primary button-large" href="{!! url('auth/login') !!}" style="float: none; text-align: center; font-size: 24px; padding: 15px; line-height: 1;">Login to Faveo</a>
|
||||
|
||||
@if(\Event::fire('helpdesk.apply.whitelabel'))
|
||||
<li class="setup-product"><a class="button button-primary button-large" href="{!! url('auth/login') !!}" style="float: none; text-align: center; font-size: 24px; padding: 15px; line-height: 1;">{!! Lang::get('lang.login_to_helpdesk') !!}</a>
|
||||
</li>
|
||||
@else
|
||||
|
||||
<li class="setup-product"><a class="button button-primary button-large" href="{!! url('auth/login') !!}" style="float: none; text-align: center; font-size: 24px; padding: 15px; line-height: 1;">{!! Lang::get('lang.login_to_faveo') !!}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="setup-next-steps-last">
|
||||
<h2>Learn More</h2>
|
||||
<h2>{!! Lang::get('lang.learn_more') !!}</h2>
|
||||
<ul>
|
||||
<li class="video-walkthrough"><a target="_blank" href="https://www.youtube.com/channel/UC-eqh-h241b1janp6sU7Iiw">Video walk through</a>
|
||||
<li class="video-walkthrough"><a target="_blank" href="https://www.youtube.com/channel/UC-eqh-h241b1janp6sU7Iiw">{!! Lang::get('lang.video_walk_through') !!}</a>
|
||||
</li>
|
||||
<li class="sidekick"><a target="_blank" href="http://www.ladybirdweb.com/support/knowledgebase">Knowledge Base</a>
|
||||
<li class="sidekick"><a target="_blank" href="http://www.ladybirdweb.com/support/knowledgebase">{!! Lang::get('lang.knowledge_base') !!}</a>
|
||||
</li>
|
||||
|
||||
<li class="newsletter"><a href="mailto:support@ladybirdweb.com">Email Support</a>
|
||||
<li class="newsletter"><a href="mailto:support@ladybirdweb.com">{!! Lang::get('lang.email_support') !!}</a>
|
||||
</li>
|
||||
<br>
|
||||
<br>
|
||||
|
@@ -21,8 +21,8 @@
|
||||
<center><a href="http://www.faveohelpdesk.com">
|
||||
<img src="{{asset("lb-faveo/media/installer/faveo.png")}}" alt="faveo" width="250px"></a></center>
|
||||
<ol class="setup-steps">
|
||||
<li class="@yield('license')">License Agreement</li>
|
||||
<li class="@yield('environment')">Environment Test</li>
|
||||
<li class="@yield('license')">License Agreement</li>
|
||||
<li class="@yield('database')">Database Setup</li>
|
||||
<li class="@yield('locale')">Locale Information</li>
|
||||
<li class="@yield('ready')">Ready</li>
|
||||
|
@@ -17,7 +17,7 @@ Route::get('/JavaScript-disabled', [
|
||||
'as' => 'js-disabled',
|
||||
'uses' => 'Installer\helpdesk\InstallController@jsDisabled',
|
||||
]);
|
||||
Route::get('/step1', [
|
||||
Route::get('/step2', [
|
||||
'as' => 'licence',
|
||||
'uses' => 'Installer\helpdesk\InstallController@licence',
|
||||
]);
|
||||
@@ -25,7 +25,7 @@ Route::post('/step1post', [
|
||||
'as' => 'postlicence',
|
||||
'uses' => 'Installer\helpdesk\InstallController@licencecheck',
|
||||
]);
|
||||
Route::get('/step2', [
|
||||
Route::get('/step1', [
|
||||
'as' => 'prerequisites',
|
||||
'uses' => 'Installer\helpdesk\InstallController@prerequisites',
|
||||
]);
|
||||
|
Reference in New Issue
Block a user