changes & fixes in installer
This commit is contained in:
parent
7a0d470c20
commit
03e18ca398
|
|
@ -1,18 +1,9 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
|
||||||
<title>Bagisto Installer</title>
|
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
|
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container admin" id="admin">
|
<div class="container admin" id="admin">
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
<div class="initial-display">
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Admin Details</p>
|
<p>Admin Details</p>
|
||||||
|
|
||||||
<form action="AdminConfig.php" method= "POST" id="admin-form">
|
<form action="AdminConfig.php" method= "POST" id="admin-form">
|
||||||
|
|
@ -49,10 +40,6 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
@ -63,7 +50,6 @@
|
||||||
$.validate({});
|
$.validate({});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// process the form
|
// process the form
|
||||||
|
|
@ -77,10 +63,12 @@
|
||||||
'admin_password' : $('input[name=admin_password]').val(),
|
'admin_password' : $('input[name=admin_password]').val(),
|
||||||
'admin_re_password' : $('input[name=admin_re_password]').val(),
|
'admin_re_password' : $('input[name=admin_re_password]').val(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var adminTarget = window.location.href.concat('/AdminConfig.php');
|
||||||
// process the form
|
// process the form
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
|
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
|
||||||
url : 'AdminConfig.php', // the url where we want to POST
|
url : adminTarget, // the url where we want to POST
|
||||||
data : formData, // our data object
|
data : formData, // our data object
|
||||||
dataType : 'json', // what type of data do we expect back from the server
|
dataType : 'json', // what type of data do we expect back from the server
|
||||||
encode : true
|
encode : true
|
||||||
|
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Permission {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $results = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the result array permissions and errors.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->results['permissions'] = [];
|
|
||||||
|
|
||||||
$this->results['errors'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check for the folders permissions.
|
|
||||||
*
|
|
||||||
* @param array $folders
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function check()
|
|
||||||
{
|
|
||||||
$folders = [
|
|
||||||
// 'permissions' => [
|
|
||||||
'storage/framework/' => '775',
|
|
||||||
'storage/logs/' => '775',
|
|
||||||
'bootstrap/cache/' => '775'
|
|
||||||
// ]
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach($folders as $folder => $permission)
|
|
||||||
{
|
|
||||||
if (!($this->getPermission($folder) >= $permission)) {
|
|
||||||
$this->addFileAndSetErrors($folder, $permission, false);
|
|
||||||
} else {
|
|
||||||
$this->addFile($folder, $permission, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->results;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a folder permission.
|
|
||||||
*
|
|
||||||
* @param $folder
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function getPermission($folder)
|
|
||||||
{
|
|
||||||
$location = str_replace('\\', '/', getcwd());
|
|
||||||
$currentLocation = explode("/", $location);
|
|
||||||
array_pop($currentLocation);
|
|
||||||
array_pop($currentLocation);
|
|
||||||
$desiredLocation = implode("/", $currentLocation);
|
|
||||||
$fileLocation = $desiredLocation . '/' .$folder;
|
|
||||||
|
|
||||||
return substr(sprintf('%o', fileperms($fileLocation)), -4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the file to the list of results.
|
|
||||||
*
|
|
||||||
* @param $folder
|
|
||||||
* @param $permission
|
|
||||||
* @param $isSet
|
|
||||||
*/
|
|
||||||
private function addFile($folder, $permission, $isSet)
|
|
||||||
{
|
|
||||||
array_push($this->results['permissions'], [
|
|
||||||
'folder' => $folder,
|
|
||||||
'permission' => $permission,
|
|
||||||
'isSet' => $isSet
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the file and set the errors.
|
|
||||||
*
|
|
||||||
* @param $folder
|
|
||||||
* @param $permission
|
|
||||||
* @param $isSet
|
|
||||||
*/
|
|
||||||
private function addFileAndSetErrors($folder, $permission, $isSet)
|
|
||||||
{
|
|
||||||
$this->addFile($folder, $permission, $isSet);
|
|
||||||
|
|
||||||
$this->results['errors'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render view for class.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
$permissions = $this->check();
|
|
||||||
|
|
||||||
include __DIR__ . '/../Views/permission.blade.php';
|
|
||||||
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,102 +1,88 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
|
||||||
<title>Bagisto Installer</title>
|
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container environment" id="environment">
|
<div class="container environment" id="environment">
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
<div class="initial-display">
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Environment Configuration</p>
|
<p>Environment Configuration</p>
|
||||||
|
|
||||||
<form action="EnvConfig.php" method="POST" id="environment-form">
|
<form action="EnvConfig.php" method="POST" id="environment-form">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="databse-error" style="text-align: center; padding-top: 10px" id="database_error">
|
<div class="databse-error" style="text-align: center; padding-top: 10px" id="database_error">
|
||||||
|
</div>
|
||||||
|
<div class="form-container" style="padding: 10%; padding-top: 35px">
|
||||||
|
<div class="control-group" id="app_name">
|
||||||
|
<label for="app_name" class="required">App Name</label>
|
||||||
|
<input type = "text" name = "app_name" class = "control"
|
||||||
|
value = "Bagisto_"
|
||||||
|
data-validation="required length" data-validation-length="max50"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-container" style="padding: 10%; padding-top: 35px">
|
|
||||||
<div class="control-group" id="app_name">
|
|
||||||
<label for="app_name" class="required">App Name</label>
|
|
||||||
<input type = "text" name = "app_name" class = "control"
|
|
||||||
value = "Bagisto_"
|
|
||||||
data-validation="required length" data-validation-length="max50"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group" id="app_url">
|
<div class="control-group" id="app_url">
|
||||||
<label for="app_url" class="required">App URL</label>
|
<label for="app_url" class="required">App URL</label>
|
||||||
<input type="text" name="app_url" class="control"
|
<input type="text" name="app_url" class="control"
|
||||||
placeholder="http://localhost"
|
placeholder="http://localhost"
|
||||||
data-validation="required length" data-validation-length="max50">
|
data-validation="required length" data-validation-length="max50">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="database_connection" class="required">
|
<label for="database_connection" class="required">
|
||||||
Database Connection
|
Database Connection
|
||||||
</label>
|
</label>
|
||||||
<select name="database_connection" id="database_connection" class="control">
|
<select name="database_connection" id="database_connection" class="control">
|
||||||
<option value="mysql" selected>Mysql</option>
|
<option value="mysql" selected>Mysql</option>
|
||||||
<option value="sqlite">SQlite</option>
|
<option value="sqlite">SQlite</option>
|
||||||
<option value="pgsql">pgSQL</option>
|
<option value="pgsql">pgSQL</option>
|
||||||
<option value="sqlsrv">SQLSRV</option>
|
<option value="sqlsrv">SQLSRV</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" id="port_name">
|
<div class="control-group" id="port_name">
|
||||||
<label for="port_name" class="required">Database Port</label>
|
<label for="port_name" class="required">Database Port</label>
|
||||||
<input type="text" name="port_name" class="control"
|
<input type="text" name="port_name" class="control"
|
||||||
placeholder="3306"
|
placeholder="3306"
|
||||||
data-validation="required alphanumeric number length" data-validation-length="max4">
|
data-validation="required alphanumeric number length" data-validation-length="max4">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" id="host_name">
|
<div class="control-group" id="host_name">
|
||||||
<label for="host_name" class="required">Database Host</label>
|
<label for="host_name" class="required">Database Host</label>
|
||||||
<input type="text" name="host_name" class="control"
|
<input type="text" name="host_name" class="control"
|
||||||
placeholder="127.0.0.1"
|
placeholder="127.0.0.1"
|
||||||
data-validation="required length" data-validation-length="max50">
|
data-validation="required length" data-validation-length="max50">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" id="database_name">
|
<div class="control-group" id="database_name">
|
||||||
<label for="database_name" class="required">Database Name</label>
|
<label for="database_name" class="required">Database Name</label>
|
||||||
<input type="text" name="database_name" class="control"
|
<input type="text" name="database_name" class="control"
|
||||||
placeholder="database name"
|
placeholder="database name"
|
||||||
data-validation="length required" data-validation-length="max50">
|
data-validation="length required" data-validation-length="max50">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" id="user_name">
|
<div class="control-group" id="user_name">
|
||||||
<label for="user_name" class="required">User Name</label>
|
<label for="user_name" class="required">User Name</label>
|
||||||
<input type="text" name="user_name" class="control"
|
<input type="text" name="user_name" class="control"
|
||||||
value = "bagisto_"
|
value = "bagisto_"
|
||||||
data-validation="length required" data-validation-length="max50">
|
data-validation="length required" data-validation-length="max50">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" id="user_password">
|
<div class="control-group" id="user_password">
|
||||||
<label for="user_password" class="required">User Password</label>
|
<label for="user_password" class="required">User Password</label>
|
||||||
<input type="text" name="user_password" class="control"
|
<input type="text" name="user_password" class="control"
|
||||||
placeholder="database password"
|
placeholder="database password"
|
||||||
data-validation="length required" data-validation-length="max50">
|
data-validation="length required" data-validation-length="max50">
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
</div>
|
||||||
<button class="prepare-btn" id="environment-check">Save & Continue</button>
|
<div>
|
||||||
<div style="cursor: pointer; margin-top:10px">
|
<button class="prepare-btn" id="environment-check">Save & Continue</button>
|
||||||
<span id="envronment-back">back</span>
|
<div style="cursor: pointer; margin-top:10px">
|
||||||
</div>
|
<span id="envronment-back">back</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
@ -128,10 +114,12 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var target = window.location.href.concat('/EnvConfig.php');
|
||||||
|
|
||||||
// process the form
|
// process the form
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : 'EnvConfig.php',
|
url : target,
|
||||||
data : formData,
|
data : formData,
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
encode : true
|
encode : true
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
|
||||||
<title>Bagisto Installer</title>
|
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container finish" id="finish">
|
<div class="container finish" id="finish">
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
<div class="initial-display">
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Finish Installment</p>
|
<p>Finish Installment</p>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="content-container" style="padding: 20px">
|
<div class="content-container" style="padding: 20px">
|
||||||
|
|
@ -23,10 +16,6 @@
|
||||||
<button class="prepare-btn" onclick="finish()">Finish</button>
|
<button class="prepare-btn" onclick="finish()">Finish</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
@ -37,8 +26,8 @@
|
||||||
|
|
||||||
function finish() {
|
function finish() {
|
||||||
lastIndex = window.location.href.lastIndexOf("/");
|
lastIndex = window.location.href.lastIndexOf("/");
|
||||||
secondlast = window.location.href.slice(0,lastIndex).lastIndexOf("/");
|
secondlast = window.location.href.slice(0, lastIndex).lastIndexOf("/");
|
||||||
next = window.location.href.slice(0,secondlast);
|
next = window.location.href.slice(0, secondlast);
|
||||||
next = next.concat('/admin/login');
|
next = next.concat('/admin/login');
|
||||||
window.location.href = next;
|
window.location.href = next;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,4 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
|
||||||
<title>Bagisto Installer</title>
|
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.window {
|
.window {
|
||||||
|
|
@ -59,8 +53,7 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container migration" id="migration">
|
<div class="container migration" id="migration">
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
<div class="initial-display">
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Migration & Seed</p>
|
<p>Migration & Seed</p>
|
||||||
|
|
||||||
<div class="cp-spinner cp-round" id="loader">
|
<div class="cp-spinner cp-round" id="loader">
|
||||||
|
|
@ -115,10 +108,6 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
@ -144,10 +133,12 @@
|
||||||
$('#storage').hide();
|
$('#storage').hide();
|
||||||
$('#composer').hide();
|
$('#composer').hide();
|
||||||
|
|
||||||
|
var composerTarget = window.location.href.concat('/Composer.php');
|
||||||
|
|
||||||
// process form
|
// process form
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : 'Composer.php',
|
url : composerTarget,
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
encode : true
|
encode : true
|
||||||
})
|
})
|
||||||
|
|
@ -163,10 +154,12 @@
|
||||||
if (data['install'] == 0) {
|
if (data['install'] == 0) {
|
||||||
$('#composer-migrate').show();
|
$('#composer-migrate').show();
|
||||||
|
|
||||||
|
var migrationTarget = window.location.href.concat('/MigrationRun.php');
|
||||||
|
|
||||||
// post the request again
|
// post the request again
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : 'MigrationRun.php',
|
url : migrationTarget,
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
encode : true
|
encode : true
|
||||||
})
|
})
|
||||||
|
|
@ -178,9 +171,11 @@
|
||||||
if (data['results'] == 0) {
|
if (data['results'] == 0) {
|
||||||
$('#composer-seed').show();
|
$('#composer-seed').show();
|
||||||
|
|
||||||
|
var seederTarget = window.location.href.concat('/Seeder.php');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : 'Seeder.php',
|
url : seederTarget,
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
encode : true
|
encode : true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ $data = array();
|
||||||
// run command on terminal
|
// run command on terminal
|
||||||
$key = 'cd ../.. && php artisan key:generate 2>&1';
|
$key = 'cd ../.. && php artisan key:generate 2>&1';
|
||||||
$seeder = 'cd ../.. && php artisan db:seed 2>&1';
|
$seeder = 'cd ../.. && php artisan db:seed 2>&1';
|
||||||
$publish = 'cd ../.. && php artisan vendor:publish 2>&1';
|
$publish = 'cd ../.. && php artisan vendor:publish --all --force 2>&1';
|
||||||
|
|
||||||
$key_output = exec($key, $data['key'], $data['key_results']);
|
$key_output = exec($key, $data['key'], $data['key_results']);
|
||||||
$seeder_output = exec($seeder, $data['seeder'], $data['seeder_results']);
|
$seeder_output = exec($seeder, $data['seeder'], $data['seeder_results']);
|
||||||
|
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
|
||||||
<title>Bagisto Installer</title>
|
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container permission" id="permission">
|
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Permission</p>
|
|
||||||
|
|
||||||
<div class="content">
|
|
||||||
<div class="title" style="text-align: center; margin-top: 10px">
|
|
||||||
Please wait while we are checking the permissions
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php foreach($permissions['permissions'] as $permission): ?>
|
|
||||||
<div class="check" style="margin-left: 20%">
|
|
||||||
<?php if($permission['isSet'] ? $src = 'Images/green-check.svg' : $src = 'Images/red-check.svg' ): ?>
|
|
||||||
<img src="<?php echo $src ?>">
|
|
||||||
<?php endif; ?>
|
|
||||||
<span style="margin-left: 10px"><b><?php echo $permission['folder'] ?></b></span>
|
|
||||||
<span>(<?php echo $permission['permission'] ?> folder permission Required)</span>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if(!isset($permissions['errors'])): ?>
|
|
||||||
<div>
|
|
||||||
<button class="prepare-btn" id="permission-check">Continue</button>
|
|
||||||
</div>
|
|
||||||
<div style="cursor: pointer; margin-top:10px">
|
|
||||||
<span id="permission-back">back</span>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
<?php
|
||||||
<title>Bagisto Installer</title>
|
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
$greenCheck = $actual_link .'/'. 'Images/green-check.svg';
|
||||||
</head>
|
$redCheck = $actual_link .'/'. 'Images/red-check.svg';
|
||||||
|
?>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container requirement" id="requirement">
|
<div class="container requirement" id="requirement">
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
<div class="initial-display">
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Requirement</p>
|
<p>Requirement</p>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="check" style="margin-left: 25%">
|
<div class="check" style="margin-left: 25%">
|
||||||
<?php if($phpVersion['supported'] ? $src = 'Images/green-check.svg' : $src = 'Images/red-check.svg' ): ?>
|
<?php if($phpVersion['supported'] ? $src = $greenCheck : $src = $redCheck): ?>
|
||||||
<img src="<?php echo $src ?>">
|
<img src="<?php echo $src ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<span style="margin-left: 10px"><b>PHP</b></span>
|
<span style="margin-left: 10px"><b>PHP</b></span>
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<?php foreach($requirements['requirements'][$type] as $extention => $enabled) : ?>
|
<?php foreach($requirements['requirements'][$type] as $extention => $enabled) : ?>
|
||||||
<div class="check" style="margin-left: 25%">
|
<div class="check" style="margin-left: 25%">
|
||||||
<?php if($enabled ? $src = 'Images/green-check.svg' : $src = 'Images/red-check.svg' ): ?>
|
<?php if($enabled ? $src = $greenCheck : $src = $redCheck ): ?>
|
||||||
<img src="<?php echo $src ?>">
|
<img src="<?php echo $src ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<span style="margin-left: 10px"><b><?php echo $extention ?></b></span>
|
<span style="margin-left: 10px"><b><?php echo $extention ?></b></span>
|
||||||
|
|
@ -49,11 +49,6 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,9 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
|
||||||
<title>Bagisto Installer</title>
|
|
||||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
|
||||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container welcome" id="welcome">
|
<div class="container welcome" id="welcome">
|
||||||
<div class="initial-display" style="padding-top: 100px;">
|
<div class="initial-display">
|
||||||
<img class="logo" src="Images/logo.svg">
|
|
||||||
<p>Welcome to Bagisto</p>
|
<p>Welcome to Bagisto</p>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
@ -31,11 +26,6 @@
|
||||||
<button type="button" class="prepare-btn" id="welcome-check">Accept</button>
|
<button type="button" class="prepare-btn" id="welcome-check">Accept</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<img class="left-patern" src="Images/left-side.svg">
|
|
||||||
<img class="right-patern" src="Images/right-side.svg">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -1,104 +1,133 @@
|
||||||
<?php
|
<html>
|
||||||
// getting env file
|
|
||||||
$location = str_replace('\\', '/', getcwd());
|
|
||||||
$currentLocation = explode("/", $location);
|
|
||||||
array_pop($currentLocation);
|
|
||||||
array_pop($currentLocation);
|
|
||||||
$desiredLocation = implode("/", $currentLocation);
|
|
||||||
$envFile = $desiredLocation . '/' . '.env';
|
|
||||||
|
|
||||||
$installed = false;
|
<?php
|
||||||
|
|
||||||
if (file_exists($envFile)) {
|
|
||||||
|
|
||||||
// reading env content
|
|
||||||
$str= file_get_contents($envFile);
|
|
||||||
|
|
||||||
// converting env content to key/value pair
|
|
||||||
$data = explode(PHP_EOL,$str);
|
|
||||||
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT'];
|
|
||||||
|
|
||||||
$key = $value = [];
|
|
||||||
if ($data) {
|
|
||||||
foreach ($data as $line) {
|
|
||||||
$rowValues = explode('=', $line);
|
|
||||||
if (count($rowValues) === 2) {
|
|
||||||
if (in_array($rowValues[0], $databaseArray)) {
|
|
||||||
$key[] = $rowValues[0];
|
|
||||||
$value[] = $rowValues[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$databaseData['DB_HOST'] = $databaseData['DB_USERNAME'] = $databaseData['DB_PASSWORD'] = $databaseData['DB_DATABASE'] = $databaseData['DB_CONNECTION'] = $databaseData['DB_PORT'] = '';
|
|
||||||
|
|
||||||
$databaseData = array_combine($key, $value);
|
|
||||||
|
|
||||||
// getting database info
|
|
||||||
$servername = $databaseData['DB_HOST'];
|
|
||||||
$username = $databaseData['DB_USERNAME'];
|
|
||||||
$password = $databaseData['DB_PASSWORD'];
|
|
||||||
$dbname = $databaseData['DB_DATABASE'];
|
|
||||||
$connection = $databaseData['DB_CONNECTION'];
|
|
||||||
$port = $databaseData['DB_PORT'];
|
|
||||||
|
|
||||||
if ($connection == 'mysql') {
|
|
||||||
@$conn = new mysqli($servername, $username, $password, $dbname, $port);
|
|
||||||
|
|
||||||
if (!$conn->connect_error) {
|
|
||||||
// retrieving admin entry
|
|
||||||
$sql = "SELECT id, name FROM admins";
|
|
||||||
$result = $conn->query($sql);
|
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
$installed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn->close();
|
|
||||||
} else {
|
|
||||||
$installed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$installed) {
|
|
||||||
// including classes
|
|
||||||
include __DIR__ . '/Classes/Permission.php';
|
|
||||||
include __DIR__ . '/Classes/Requirement.php';
|
|
||||||
include __DIR__ . '/Classes/Welcome.php';
|
|
||||||
|
|
||||||
// including php files
|
|
||||||
include __DIR__ . '/Environment.php';
|
|
||||||
include __DIR__ . '/Migration.php';
|
|
||||||
include __DIR__ . '/Admin.php';
|
|
||||||
include __DIR__ . '/Finish.php';
|
|
||||||
|
|
||||||
// including js
|
|
||||||
include __DIR__ . '/JS/script';
|
|
||||||
|
|
||||||
// object creation
|
|
||||||
$requirement = new Requirement();
|
|
||||||
$permission = new Permission();
|
|
||||||
$welcome = new Welcome();
|
|
||||||
|
|
||||||
// calling render function for template
|
|
||||||
echo $requirement->render();
|
|
||||||
echo $permission->render();
|
|
||||||
echo $welcome->render();
|
|
||||||
|
|
||||||
$storage_output = exec('cd ../.. && php artisan storage:link 2>&1');
|
|
||||||
} else {
|
|
||||||
// getting url
|
|
||||||
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||||
|
|
||||||
$url = explode("/", $actual_link);
|
$cssUrl = $actual_link .'/'. 'CSS/style.css';
|
||||||
array_pop($url);
|
$logo = $actual_link .'/'. 'Images/logo.svg';
|
||||||
array_pop($url);
|
$leftIcon = $actual_link .'/'. 'Images/left-side.svg';
|
||||||
$url = implode("/", $url);
|
$rightIcon = $actual_link .'/'. 'Images/right-side.svg';
|
||||||
$url = $url . '/404';
|
?>
|
||||||
|
|
||||||
// redirecting to 404 error page
|
<head>
|
||||||
header("Location: $url");
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||||
}
|
<title>Bagisto Installer</title>
|
||||||
?>
|
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||||
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href= "<?php echo $cssUrl; ?> ">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container requirement">
|
||||||
|
<div class="initial-display" style="padding-top: 100px;">
|
||||||
|
<img class="logo" src= "<?php echo $logo; ?>" >
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
<img class="left-patern" src= "<?php echo $leftIcon; ?>" >
|
||||||
|
<img class="right-patern" src= "<?php echo $rightIcon; ?>" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// getting env file
|
||||||
|
$location = str_replace('\\', '/', getcwd());
|
||||||
|
$currentLocation = explode("/", $location);
|
||||||
|
array_pop($currentLocation);
|
||||||
|
array_pop($currentLocation);
|
||||||
|
$desiredLocation = implode("/", $currentLocation);
|
||||||
|
$envFile = $desiredLocation . '/' . '.env';
|
||||||
|
|
||||||
|
$installed = false;
|
||||||
|
|
||||||
|
if (file_exists($envFile)) {
|
||||||
|
|
||||||
|
// reading env content
|
||||||
|
$str= file_get_contents($envFile);
|
||||||
|
|
||||||
|
// converting env content to key/value pair
|
||||||
|
$data = explode(PHP_EOL,$str);
|
||||||
|
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT'];
|
||||||
|
|
||||||
|
$key = $value = [];
|
||||||
|
if ($data) {
|
||||||
|
foreach ($data as $line) {
|
||||||
|
$rowValues = explode('=', $line);
|
||||||
|
if (count($rowValues) === 2) {
|
||||||
|
if (in_array($rowValues[0], $databaseArray)) {
|
||||||
|
$key[] = $rowValues[0];
|
||||||
|
$value[] = $rowValues[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$databaseData['DB_HOST'] = $databaseData['DB_USERNAME'] = $databaseData['DB_PASSWORD'] = $databaseData['DB_DATABASE'] = $databaseData['DB_CONNECTION'] = $databaseData['DB_PORT'] = '';
|
||||||
|
|
||||||
|
$databaseData = array_combine($key, $value);
|
||||||
|
|
||||||
|
// getting database info
|
||||||
|
$servername = $databaseData['DB_HOST'];
|
||||||
|
$username = $databaseData['DB_USERNAME'];
|
||||||
|
$password = $databaseData['DB_PASSWORD'];
|
||||||
|
$dbname = $databaseData['DB_DATABASE'];
|
||||||
|
$connection = $databaseData['DB_CONNECTION'];
|
||||||
|
$port = $databaseData['DB_PORT'];
|
||||||
|
|
||||||
|
if ($connection == 'mysql') {
|
||||||
|
@$conn = new mysqli($servername, $username, $password, $dbname, $port);
|
||||||
|
|
||||||
|
if (!$conn->connect_error) {
|
||||||
|
// retrieving admin entry
|
||||||
|
$sql = "SELECT id, name FROM admins";
|
||||||
|
$result = $conn->query($sql);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$installed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
|
} else {
|
||||||
|
$installed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$installed) {
|
||||||
|
|
||||||
|
// including classes
|
||||||
|
include __DIR__ . '/Classes/Requirement.php';
|
||||||
|
|
||||||
|
// including php files
|
||||||
|
include __DIR__ . '/Environment.php';
|
||||||
|
include __DIR__ . '/Migration.php';
|
||||||
|
include __DIR__ . '/Admin.php';
|
||||||
|
include __DIR__ . '/Finish.php';
|
||||||
|
|
||||||
|
// including js
|
||||||
|
include __DIR__ . '/JS/script';
|
||||||
|
|
||||||
|
// object creation
|
||||||
|
$requirement = new Requirement();
|
||||||
|
echo $requirement->render();
|
||||||
|
|
||||||
|
$storage_output = exec('cd ../.. && php artisan storage:link 2>&1');
|
||||||
|
} else {
|
||||||
|
// getting url
|
||||||
|
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||||
|
|
||||||
|
$url = explode("/", $actual_link);
|
||||||
|
array_pop($url);
|
||||||
|
array_pop($url);
|
||||||
|
$url = implode("/", $url);
|
||||||
|
$url = $url . '/404';
|
||||||
|
|
||||||
|
// redirecting to 404 error page
|
||||||
|
header("Location: $url");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue