Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
f000615e68
commit
268b7b13f6
@@ -7,24 +7,24 @@ use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\DatabaseRequest;
|
||||
use App\Http\Requests\helpdesk\InstallerRequest;
|
||||
use Illuminate\Http\Request;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
// models
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\User;
|
||||
// classes
|
||||
use Artisan;
|
||||
// classes
|
||||
use Cache;
|
||||
use Config;
|
||||
use DB;
|
||||
use Exception;
|
||||
use File;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Cache;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
@@ -36,21 +36,23 @@ use Cache;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class InstallController extends Controller {
|
||||
|
||||
class InstallController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get Licence (step 1).
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function licence() {
|
||||
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")) {
|
||||
if (file_exists($directory.DIRECTORY_SEPARATOR.'.env')) {
|
||||
return redirect('/auth/login');
|
||||
} else {
|
||||
Cache::flush();
|
||||
Artisan::call('config:clear');
|
||||
|
||||
return view('themes/default1/installer/helpdesk/view1');
|
||||
}
|
||||
}
|
||||
@@ -60,11 +62,13 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function licencecheck(Request $request) {
|
||||
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');
|
||||
|
||||
return Redirect::route('prerequisites');
|
||||
} else {
|
||||
return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
@@ -79,7 +83,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisites(Request $request) {
|
||||
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');
|
||||
@@ -94,8 +99,10 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisitescheck(Request $request) {
|
||||
public function prerequisitescheck(Request $request)
|
||||
{
|
||||
Cache::forever('step2', 'step2');
|
||||
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
|
||||
@@ -105,7 +112,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function localization(Request $request) {
|
||||
public function localization(Request $request)
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Cache::get('step2') == 'step2') {
|
||||
return View::make('themes/default1/installer/helpdesk/view3');
|
||||
@@ -120,7 +128,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function localizationcheck(Request $request) {
|
||||
public function localizationcheck(Request $request)
|
||||
{
|
||||
Cache::forever('step3', 'step3');
|
||||
|
||||
$request->session()->put('step3', 'step3');
|
||||
@@ -138,7 +147,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configuration(Request $request) {
|
||||
public function configuration(Request $request)
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Cache::get('step2') == 'step2') {
|
||||
return View::make('themes/default1/installer/helpdesk/view3');
|
||||
@@ -153,7 +163,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configurationcheck(DatabaseRequest $request) {
|
||||
public function configurationcheck(DatabaseRequest $request)
|
||||
{
|
||||
Cache::forever('step4', 'step4');
|
||||
|
||||
Session::set('default', $request->input('default'));
|
||||
@@ -171,8 +182,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postconnection(Request $request) {
|
||||
|
||||
public function postconnection(Request $request)
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
$default = Input::get('default');
|
||||
$host = Input::get('host');
|
||||
@@ -207,7 +218,7 @@ class InstallController extends Controller {
|
||||
$config .= "{$key}={$val}\n";
|
||||
}
|
||||
// Write environment file
|
||||
$fp = fopen(base_path() . '/.env', 'w');
|
||||
$fp = fopen(base_path().'/.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
@@ -220,7 +231,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function database(Request $request) {
|
||||
public function database(Request $request)
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Cache::get('step4') == 'step4') {
|
||||
return View::make('themes/default1/installer/helpdesk/view4');
|
||||
@@ -235,10 +247,12 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function account(Request $request) {
|
||||
public function account(Request $request)
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Cache::get('step4') == 'step4') {
|
||||
$request->session()->put('step5', $request->input('step5'));
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view5');
|
||||
} else {
|
||||
return Redirect::route('configuration');
|
||||
@@ -253,7 +267,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function accountcheck(InstallerRequest $request) {
|
||||
public function accountcheck(InstallerRequest $request)
|
||||
{
|
||||
// checking is the installation was done previously
|
||||
try {
|
||||
$check_for_pre_installation = System::all();
|
||||
@@ -261,10 +276,9 @@ class InstallController extends Controller {
|
||||
return redirect()->back()->with('fails', 'The data in database already exist. Please provide fresh database');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
if ($request->input('dummy-data') == 'on') {
|
||||
$path = base_path() . '/DB/dummy-data.sql';
|
||||
$path = base_path().'/DB/dummy-data.sql';
|
||||
DB::unprepared(file_get_contents($path));
|
||||
} else {
|
||||
// migrate database
|
||||
@@ -302,26 +316,27 @@ class InstallController extends Controller {
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
$system->time_zone = $timezones->id;
|
||||
$version = \Config::get('app.version');
|
||||
$version = explode(" ", $version);
|
||||
$version = explode(' ', $version);
|
||||
$version = $version[1];
|
||||
$system->version = $version;
|
||||
$system->save();
|
||||
|
||||
// creating an user
|
||||
$user = User::create([
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'assign_group' => 1,
|
||||
'primary_dpt' => 1,
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
'primary_dpt' => 1,
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
]);
|
||||
// checking if the user have been created
|
||||
if ($user) {
|
||||
Cache::forever('step6', 'step6');
|
||||
|
||||
return Redirect::route('final');
|
||||
}
|
||||
}
|
||||
@@ -332,11 +347,12 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function finalize() {
|
||||
// checking if the installation have been completed or not
|
||||
if (Cache::get('step6') == "step6") {
|
||||
public function finalize()
|
||||
{
|
||||
// checking if the installation have been completed or not
|
||||
if (Cache::get('step6') == 'step6') {
|
||||
$value = '1';
|
||||
$install = base_path() . DIRECTORY_SEPARATOR . '.env';
|
||||
$install = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
$datacontent = File::get($install);
|
||||
$datacontent = str_replace('%0%', $value, $datacontent);
|
||||
File::put($install, $datacontent);
|
||||
@@ -349,20 +365,20 @@ class InstallController extends Controller {
|
||||
$content24 = File::get($path23);
|
||||
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
|
||||
$content24 = str_replace("'%url%'", $lfmpath, $content24);
|
||||
$link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$pos = strpos($link, 'final');
|
||||
$link = substr($link, 0, $pos);
|
||||
$app_url = base_path() . DIRECTORY_SEPARATOR . '.env';
|
||||
$app_url = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
$datacontent2 = File::get($app_url);
|
||||
$datacontent2 = str_replace('http://localhost', $link, $datacontent2);
|
||||
File::put($app_url, $datacontent2);
|
||||
File::put($path22, $content23);
|
||||
File::put($path23, $content24);
|
||||
try {
|
||||
|
||||
Cache::flush();
|
||||
|
||||
Artisan::call('key:generate');
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view6');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('account')->with('fails', $e->getMessage());
|
||||
@@ -378,7 +394,8 @@ class InstallController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function finalcheck() {
|
||||
public function finalcheck()
|
||||
{
|
||||
try {
|
||||
return redirect('/auth/login');
|
||||
} catch (Exception $e) {
|
||||
@@ -386,8 +403,9 @@ class InstallController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function changeFilePermission() {
|
||||
$path1 = base_path() . DIRECTORY_SEPARATOR . '.env';
|
||||
public function changeFilePermission()
|
||||
{
|
||||
$path1 = base_path().DIRECTORY_SEPARATOR.'.env';
|
||||
if (chmod($path1, 0644)) {
|
||||
$f1 = substr(sprintf('%o', fileperms($path1)), -3);
|
||||
if ($f1 >= '644') {
|
||||
@@ -400,8 +418,8 @@ class InstallController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function jsDisabled() {
|
||||
public function jsDisabled()
|
||||
{
|
||||
return view('themes/default1/installer/helpdesk/check-js')->with('url', 'step1');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user