This commit is contained in:
merdan 2021-10-24 20:19:08 +05:00
parent b59f3875b3
commit ca6ebf513a
33 changed files with 238 additions and 2235 deletions

View File

@ -102,7 +102,8 @@
"Webkul\\BookingProduct\\": "packages/Webkul/BookingProduct/src",
"Webkul\\SocialLogin\\": "packages/Webkul/SocialLogin/src",
"Webkul\\DebugBar\\": "packages/Webkul/DebugBar/src",
"Webkul\\Marketing\\": "packages/Webkul/Marketing/src"
"Webkul\\Marketing\\": "packages/Webkul/Marketing/src",
"Sarga\\Shop\\": "packages/Sarga/Shop/src"
}
},
"autoload-dev": {

View File

@ -13,7 +13,7 @@ return [
|
*/
'name' => env('APP_NAME', 'Bagisto'),
'name' => env('APP_NAME', 'Sarga'),
/*
|--------------------------------------------------------------------------
@ -77,7 +77,7 @@ return [
|
*/
'timezone' => env('APP_TIMEZONE', 'Asia/Kolkata'),
'timezone' => env('APP_TIMEZONE', 'Asia/Ashgabat'),
/*
|--------------------------------------------------------------------------
@ -118,7 +118,7 @@ return [
| (use capital letters!)
*/
'default_country' => null,
'default_country' => 'TM',
/*
|--------------------------------------------------------------------------
@ -129,7 +129,7 @@ return [
|
*/
'currency' => env('APP_CURRENCY', 'USD'),
'currency' => env('APP_CURRENCY', 'TMT'),
/*
|--------------------------------------------------------------------------
@ -140,7 +140,7 @@ return [
|
*/
'channel' => 'default',
'channel' => 'trendyol',
/*
|--------------------------------------------------------------------------
@ -269,16 +269,16 @@ return [
Webkul\Checkout\Providers\CheckoutServiceProvider::class,
Webkul\Shipping\Providers\ShippingServiceProvider::class,
Webkul\Payment\Providers\PaymentServiceProvider::class,
Webkul\Paypal\Providers\PaypalServiceProvider::class,
// Webkul\Paypal\Providers\PaypalServiceProvider::class,
Webkul\Sales\Providers\SalesServiceProvider::class,
Webkul\Tax\Providers\TaxServiceProvider::class,
Webkul\API\Providers\APIServiceProvider::class,
Webkul\CatalogRule\Providers\CatalogRuleServiceProvider::class,
Webkul\CartRule\Providers\CartRuleServiceProvider::class,
Webkul\Rule\Providers\RuleServiceProvider::class,
Webkul\CMS\Providers\CMSServiceProvider::class,
Webkul\Velocity\Providers\VelocityServiceProvider::class,
Webkul\BookingProduct\Providers\BookingProductServiceProvider::class,
// Webkul\CMS\Providers\CMSServiceProvider::class,
// Webkul\Velocity\Providers\VelocityServiceProvider::class,
// Webkul\BookingProduct\Providers\BookingProductServiceProvider::class,
Webkul\SocialLogin\Providers\SocialLoginServiceProvider::class,
Webkul\DebugBar\Providers\DebugBarServiceProvider::class,
Webkul\Marketing\Providers\MarketingServiceProvider::class,

View File

@ -5,6 +5,7 @@ namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Velocity\Database\Seeders\VelocityMetaDataSeeder;
use Webkul\Admin\Database\Seeders\DatabaseSeeder as BagistoDatabaseSeeder;
use Sarga\Shop\Database\Seeders\DatabaseSeeder as SargaDatabaseSeeder;
class DatabaseSeeder extends Seeder
{
@ -15,7 +16,8 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(BagistoDatabaseSeeder::class);
$this->call(VelocityMetaDataSeeder::class);
// $this->call(BagistoDatabaseSeeder::class);
// $this->call(VelocityMetaDataSeeder::class);
$this->call(SargaDatabaseSeeder::class);
}
}

View File

@ -0,0 +1,30 @@
{
"name": "sarga/shop",
"description": "Shop for Sarga.",
"license": "MIT",
"authors": [
{
"name": "merdan muhammedow",
"email": "merdan.m@gmail.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"Sarga\\Shop\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Sarga\\Shop\\Providers\\ShopServiceProvider"
],
"aliases": {}
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,17 @@
<?php namespace Sarga\Shop\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ChannelTableSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Sarga\Shop\Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(SLocalesTableSeeder::class);
$this->call(DemoCategoryTableSeeder::class);
$this->call(ChannelTableSeeder::class);
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace Sarga\Shop\Database\Seeders;
use Faker\Generator as Faker;
use Illuminate\Database\Seeder;
use Webkul\Category\Repositories\CategoryRepository;
class DemoCategoryTableSeeder extends Seeder
{
private $numberOfParentCategories = 10;
private $numberOfChildCategories = 5;
public function __construct(
Faker $faker,
CategoryRepository $categoryRepository
)
{
$this->faker = $faker;
$this->categoryRepository = $categoryRepository;
}
public function run()
{
$this->categoryRepository->deleteWhere([['id', '!=', 1]]);
for ($i = 2; $i < $this->numberOfParentCategories; $i++) {
$createdCategory = $this->categoryRepository->create([
'id' => $i,
'slug' => $this->faker->slug,
'name' => $this->faker->firstName,
'description' => $this->faker->text(),
'parent_id' => 1,
'status' => 1,
]);
if ($createdCategory) {
for ($j = ($i-1)*$this->numberOfParentCategories; $j < ($i-1)*$this->numberOfParentCategories+$this->numberOfChildCategories; ++$j) {
$this->categoryRepository->create([
'id' => $j,
'slug' => $this->faker->slug,
'name' => $this->faker->firstName,
'description' => $this->faker->text(),
'parent_id' => $createdCategory->id,
'status' => 1
]);
}
}
}
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Sarga\Shop\Database\Seeders;
use Illuminate\Database\Seeder;
class SLocalesTableSeeder extends Seeder
{
public function run(){}
}

View File

@ -0,0 +1,93 @@
<?php
namespace Sarga\Shop\Providers;
use Webkul\Core\Tree;
use Illuminate\Routing\Router;
use Illuminate\Pagination\Paginator;
use Webkul\Shop\Http\Middleware\Theme;
use Illuminate\Support\ServiceProvider;
use Webkul\Shop\Http\Middleware\Locale;
use Webkul\Shop\Http\Middleware\Currency;
class ShopServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
/* publishers */
// $this->publishes([
// __DIR__ . '/../../publishable/assets' => public_path('themes/default/assets'),
// __DIR__ . '/../Resources/views' => resource_path('themes/default/views'),
// __DIR__ . '/../Resources/lang' => resource_path('lang/vendor/shop'),
// ]);
/* loaders */
// $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
// $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
// $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'shop');
// $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'shop');
/* aliases */
// $router->aliasMiddleware('locale', Locale::class);
// $router->aliasMiddleware('theme', Theme::class);
// $router->aliasMiddleware('currency', Currency::class);
/* view composers */
// $this->composeView();
/* paginators */
// Paginator::defaultView('shop::partials.pagination');
// Paginator::defaultSimpleView('shop::partials.pagination');
}
/**
* Register services.
*
* @return void
*/
public function register()
{
// $this->registerConfig();
}
/**
* Bind the the data to the views.
*
* @return void
*/
protected function composeView()
{
view()->composer('shop::customers.account.partials.sidemenu', function ($view) {
$tree = Tree::create();
foreach (config('menu.customer') as $item) {
$tree->add($item, 'menu');
}
$tree->items = core()->sortItems($tree->items);
$view->with('menu', $tree);
});
}
/**
* Register package config.
*
* @return void
*/
protected function registerConfig()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php', 'menu.customer'
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/system.php', 'core'
);
}
}

View File

@ -1,115 +0,0 @@
<?php
$phpbin = PHP_BINDIR . '/php';
// array to hold validation errors
$errors = array();
// array to pass back data
$data = array();
// validate the variables
// if any of these variables don't exist, add an error to our $errors array
if (empty($_POST['admin_email']))
$errors['admin_email'] = 'Email is required.';
if (empty($_POST['admin_name']))
$errors['admin_name'] = 'Name is required.';
if (empty($_POST['admin_password']))
$errors['admin_password'] = 'Password is required.';
if (empty($_POST['admin_re_password']))
$errors['admin_re_password'] = 'Re-Password is required.';
if ($_POST['admin_re_password'] !== $_POST['admin_password'])
$errors['password_match'] = 'Password & Re-Password did not match';
// return a response
// if there are any errors in our errors array, return a success boolean of false
if ( ! empty($errors)) {
// if there are items in our errors array, return those errors
$data['success'] = false;
$data['errors'] = $errors;
} else {
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$envFile = $desiredLocation . '/' . '.env';
// reading env content
$data = file($envFile);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION', 'DB_PORT'];
$key = $value = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (strlen($line) !== 0) {
if (in_array($rowValues[0], $databaseArray)) {
$key[] = $rowValues[0];
$value[] = $rowValues[1];
}
}
}
}
$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' ) {
// Create connection
@$conn = new mysqli($servername, $username, $password, $dbname, (int)$port);
// check connection
if ($conn->connect_error) {
$data['connection'] = $conn->connect_error;
}
$email = $_POST['admin_email'];
$name = $_POST['admin_name'];
$password = password_hash($_POST['admin_password'], PASSWORD_BCRYPT, ['cost' => 10]);
// Deleting migrated admin
$deleteAdmin = "DELETE FROM admins WHERE id=1";
$conn->query($deleteAdmin);
// query for insertion
$sql = "INSERT INTO admins (name, email, password, role_id, status)
VALUES ('".$name."', '".$email."', '".$password."', '1', '1')";
if ($conn->query($sql) === TRUE) {
$data['insert_success'] = 'Data Successfully inserted into database';
} else {
$data['insert_fail'] = "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
} else {
$data['support_error'] = 'Bagisto currently support MySQL only. Press OK to still continue or change you DB connection to MySQL';
}
$storage_output = exec('cd ../.. && '. $phpbin .' artisan storage:link 2>&1');
// if there are no errors process our form, then return a message
// show a message of success and provide a true success variable
$data['success'] = true;
$data['message'] = 'Success!';
}
// return all our data to an AJAX call
echo json_encode($data);

View File

@ -1,350 +0,0 @@
body {
margin: 0;
font-size: 16px;
font-family: "Montserrat", sans-serif;
color: #000311;
background: #fff;
position: relative;
height: 100%;
}
a { color: rgb(0, 65, 255); text-decoration: none;}
.initial-display{
padding-top: 50px;
text-align: center;
}
.initial-display .logo {
width: 150px;
}
.initial-display p {
font-size: 24px;
color: #333333;
text-align: center;
font-weight: 600;
margin-top: 10px;
padding-bottom: 10px;
}
.card {
border-radius: 5px;
box-shadow: 1px 9px 18px rgba(62, 85, 120, 0.45);
}
.btn-primary {
background-color: #0041FF;
}
.warning {
margin-left: 15%;
}
.footer {
bottom: 0;
position: absolute;
width: 100%;
padding-bottom: 20px;
}
.form-control{
border: 2px solid #C7C7C7;
border-radius: 3px;
-webkit-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
padding: 0px 10px;
font-size: 15px;
margin-top: 10px;
}
.form-control:focus {
border-color: #0041FF;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset, 0px 0px 8px rgba(11, 50, 139, 0.5);
}
.form-group label.required::after {
margin-left: 1px;
content: "*";
color: #FC6868;
font-weight: 700;
display: inline-block;
}
.form-error {
color: #ff5656 !important;
}
.control-group.has-error .control {
border-color: #FC6868 !important;
}
.requirements_list {
width: 90%;
list-style: none;
margin-left: 4%;
padding:0;
}
.requirements_list li {
padding: 0 10px 10px;
margin-bottom: 10px;
border-bottom: 1px dashed #dcdcdc;
line-height: normal;
}
.requirements_list li:last-child { border-bottom: 0;}
.requirements_list small {
font-size: 13px;
color:#9b9b9b;
}
.title {
font-size: 16px;
color: #151515;
line-height: 30px;
text-align: left;
margin-top: 30px;
margin-bottom: 10px;
text-align: center;
}
.welcome, .environment, .migration, .permission, .admin, .finish {
display : none;
}
.check {
line-height: 35px;
margin-left: 25%;
}
.composer {
position: auto;
top: calc(50% + 24px);
display: none;
}
.message {
padding-left: 140px;
}
.cp-round {
position: auto !important;
padding-bottom: 130px;
}
.cp-round:before {
border-radius: 50%;
content: " ";
width: 48px;
height: 48px;
display: inline-block;
box-sizing: border-box;
border-top: solid 6px #bababa;
border-right: solid 6px #bababa;
border-bottom: solid 6px #bababa;
border-left: solid 6px #bababa;
position: absolute;
top: calc(40% - 14px);
left: calc(50% - 24px);
}
.cp-round:after {
border-radius: 50%;
content: " ";
width: 48px;
height: 48px;
display: inline-block;
box-sizing: border-box;
border-top: solid 6px #0041FF;
border-right: solid 6px #bababa;
border-bottom: solid 6px #bababa;
border-left: solid 6px #bababa;
position: absolute;
top: calc(40% - 14px);
left: calc(50% - 24px);
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
.initial-display{
padding-top: 15px;
}
.initial-display p {
margin-top: 4px;
}
}
/* Select */
.select2-container--bootstrap4 .select2-selection--single {
height: calc(2.25rem + 2px) !important; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder {
color: #757575;
line-height: 2.25rem; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
position: absolute;
top: 50%;
right: 3px;
width: 20px; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
top: 60%;
border-color: #343a40 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
width: 0;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
line-height: 2.25rem; }
.select2-search--dropdown .select2-search__field {
border: 1px solid #ced4da;
border-radius: 0.25rem; }
.select2-results__message {
color: #6c757d; }
.select2-container--bootstrap4 .select2-selection--multiple {
min-height: calc(2.25rem + 2px) !important; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered {
-webkit-box-sizing: border-box;
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
color: #343a40;
border: 1px solid #bdc6d0;
border-radius: 0.2rem;
padding: 0;
padding-right: 5px;
cursor: pointer;
float: left;
margin-top: 0.3em;
margin-right: 5px; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove {
color: #bdc6d0;
font-weight: bold;
margin-left: 3px;
margin-right: 1px;
padding-right: 3px;
padding-left: 3px;
float: left; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #343a40; }
.select2-container {
display: block; }
.select2-container *:focus {
outline: 0; }
.input-group .select2-container--bootstrap4 {
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1; }
.input-group-prepend ~ .select2-container--bootstrap4 .select2-selection {
border-top-left-radius: 0;
border-bottom-left-radius: 0; }
.input-group > .select2-container--bootstrap4:not(:last-child) .select2-selection {
border-top-right-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--bootstrap4 .select2-selection {
background-color: #fff;
border: 1px solid #ced4da;
border-radius: 0.25rem;
-webkit-transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
width: 100%; }
@media screen and (prefers-reduced-motion: reduce) {
.select2-container--bootstrap4 .select2-selection {
-webkit-transition: none;
transition: none; } }
.select2-container--bootstrap4.select2-container--focus .select2-selection {
border-color: #0041FF;
-webkit-box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
.select2-container--bootstrap4.select2-container--focus.select2-container--open .select2-selection {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--bootstrap4.select2-container--disabled .select2-selection, .select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-selection {
background-color: #e9ecef;
cursor: not-allowed;
border-color: #ced4da;
-webkit-box-shadow: none;
box-shadow: none; }
.select2-container--bootstrap4.select2-container--disabled .select2-search__field, .select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-search__field {
background-color: transparent; }
select.is-invalid ~ .select2-container--bootstrap4 .select2-selection,
form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection {
border-color: #dc3545; }
select.is-valid ~ .select2-container--bootstrap4 .select2-selection,
form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-selection {
border-color: #28a745; }
.select2-container--bootstrap4 .select2-dropdown {
border-color: #ced4da;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--bootstrap4 .select2-dropdown.select2-dropdown--above {
border-top: 1px solid #ced4da;
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem; }
.select2-container--bootstrap4 .select2-dropdown .select2-results__option[aria-selected=true] {
background-color: #e9ecef; }
.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected=true] {
background-color: #0041FF;
color: #f8f9fa; }
.select2-container--bootstrap4 .select2-results__option[role=group] {
padding: 0; }
.select2-container--bootstrap4 .select2-results > .select2-results__options {
max-height: 15em;
overflow-y: auto; }
.select2-container--bootstrap4 .select2-results__group {
padding: 6px;
display: list-item;
color: #6c757d; }
.select2-container--bootstrap4 .select2-selection__clear {
width: 1.2em;
height: 1.2em;
line-height: 1.15em;
padding-left: 0.3em;
margin-top: 0.5em;
border-radius: 100%;
background-color: #6c757d;
color: #f8f9fa;
float: right;
margin-right: 0.3em; }
.select2-container--bootstrap4 .select2-selection__clear:hover {
background-color: #343a40; }

View File

@ -1,161 +0,0 @@
<?php
class Requirement {
/**
* Check for the server requirements.
*
* @param array $requirements
* @return array
*/
public function checkRequirements()
{
// Server Requirements
$requirements = [
'php' => [
'openssl',
'pdo',
'mbstring',
'tokenizer',
'JSON',
'cURL',
],
// 'apache' => [
// 'mod_rewrite',
// ]
];
$results = [];
foreach($requirements as $type => $requirement)
{
switch ($type) {
// check php requirements
case 'php':
foreach($requirements[$type] as $requirement)
{
$results['requirements'][$type][$requirement] = true;
if(!extension_loaded($requirement))
{
$results['requirements'][$type][$requirement] = false;
$results['errors'] = true;
}
}
break;
// check apache requirements
// case 'apache':
// foreach ($requirements[$type] as $requirement) {
// // if function doesn't exist we can't check apache modules
// if(function_exists('apache_get_modules'))
// {
// $results['requirements'][$type][$requirement] = true;
// if(!in_array($requirement,apache_get_modules()))
// {
// $results['requirements'][$type][$requirement] = false;
// $results['errors'] = true;
// }
// }
// }
//break;
}
}
return $results;
}
/**
* Check PHP version requirement.
*
* @return array
*/
public function checkPHPversion()
{
/**
* Minimum PHP Version Supported (Override is in installer.php config file).
*
* @var _minPhpVersion
*/
$_minPhpVersion = '7.3.0';
$currentPhpVersion = $this->getPhpVersionInfo();
$supported = false;
if (version_compare((str_pad($currentPhpVersion['version'], 6, "0")), $_minPhpVersion) >= 0) {
$supported = true;
}
$phpStatus = [
'full' => $currentPhpVersion['full'],
'current' => $currentPhpVersion['version'],
'minimum' => $_minPhpVersion,
'supported' => $supported
];
return $phpStatus;
}
/**
* Get current Php version information
*
* @return array
*/
private static function getPhpVersionInfo()
{
$currentVersionFull = PHP_VERSION;
preg_match("#^\d+(\.\d+)*#", $currentVersionFull, $filtered);
$currentVersion = $filtered[0];
return [
'full' => $currentVersionFull,
'version' => $currentVersion
];
}
/**
* Check composer installation.
*
* @return array
*/
public function composerInstall()
{
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php';
if (file_exists($autoLoadFile)) {
$data['composer_install'] = 0;
} else {
$data['composer_install'] = 1;
$data['composer'] = 'Bagisto has detected that the required composer dependencies are not installed.<br />Go to the root directory of Bagisto and run "composer install".';
}
return $data;
}
/**
* Render view for class.
*
*/
public function render()
{
$requirements = $this->checkRequirements();
$phpVersion = $this->checkPHPversion();
$composerInstall = $this->composerInstall();
ob_start();
include __DIR__ . '/../Views/requirements.blade.php';
return ob_get_clean();
}
}

View File

@ -1,17 +0,0 @@
<?php
class Welcome {
/**
* Render view for class.
*
*/
public function render()
{
ob_start();
include __DIR__ . '/../Views/welcome.blade.php';
return ob_get_clean();
}
}

View File

@ -1,21 +0,0 @@
<?php
function delete_files($target) {
if(is_dir($target)){
$files = glob( $target . '*', GLOB_MARK );
foreach( $files as $file ){
delete_files( $file );
}
rmdir( $target );
} elseif(is_file($target)) {
unlink( $target );
}
}
$data['success'] = true;
$data['message'] = 'Success!';
echo json_encode($data);
sleep(2);
delete_files($_SERVER['DOCUMENT_ROOT'] . '/installer');
?>

View File

@ -1,6 +0,0 @@
<?php
$data = array();
$data['install'] = 0;
echo json_encode($data);

View File

@ -1,96 +0,0 @@
<?php
// array to hold validation errors
$errors = array();
// array to pass back data
$data = array();
// validate the variables
// if any of these variables don't exist, add an error to our $errors array
if (empty($_POST['mail_driver']))
$errors['mail_driver'] = 'Please select the mail driver.';
if (empty($_POST['mail_host']))
$errors['mail_host'] = 'Please enter the hostname for this outgoing mail server.';
if (empty($_POST['mail_port']))
$errors['mail_port'] = 'Please enter the port for this outgoing mail server.';
// if (empty($_POST['mail_encryption']))
// $errors['mail_encryption'] = 'Please select the encryption method for this outgoing mail server.';
if (empty($_POST['mail_from']))
$errors['mail_from'] = 'Please enter the email address for this store.';
if (empty($_POST['mail_username']))
$errors['mail_username'] = 'Please enter your email address or username.';
if (preg_match('/\s/', $_POST['mail_username']))
$errors['mail_username'] = 'There should be no space in Username.';
if (empty($_POST['mail_password']))
$errors['mail_password'] = 'Please enter the password for this email address.';
// return a response
// if there are any errors in our errors array, return a success boolean of false
if(!empty($errors)) {
// if there are items in our errors array, return those errors
$data['success'] = false;
$data['errors'] = $errors;
} else {
// if there are no errors process our form, then return a message
// show a message of success and provide a true success variable
// getting env file location
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$envFile = $desiredLocation . '/' . '.env';
// reading env content
$data = file($envFile);
$keyValueData = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (strlen($line) !== 0) {
$keyValueData[$rowValues[0]] = $rowValues[1];
}
}
}
// inserting form data to empty array
$keyValueData['MAIL_DRIVER'] = $_POST["mail_driver"];
$keyValueData['MAIL_HOST'] = $_POST["mail_host"];
$keyValueData['MAIL_PORT'] = $_POST["mail_port"];
$keyValueData['MAIL_ENCRYPTION'] = $_POST["mail_encryption"];
$keyValueData['MAIL_USERNAME'] = $_POST["mail_username"];
$keyValueData['MAIL_PASSWORD'] = $_POST["mail_password"];
$keyValueData['SHOP_MAIL_FROM'] = $_POST["mail_from"];
// making key/value pair with form-data for env
$changedData = [];
foreach ($keyValueData as $key => $value) {
$changedData[] = $key . '=' . $value;
}
// inserting new form-data to env
$changedData = implode(PHP_EOL, $changedData);
file_put_contents($envFile, $changedData);
$data['success'] = true;
$data['message'] = 'Success!';
}
// return all our data to an AJAX call
echo json_encode($data);

View File

@ -1,143 +0,0 @@
<?php
// array to hold validation errors
$errors = [];
// array to pass back data
$data = [];
// validate the variables
// if any of these variables don't exist, add an error to our $errors array
if (empty($_POST['app_name']))
$errors['app_name'] = 'App Name is required.';
if (empty($_POST['app_url']))
$errors['app_url'] = 'App Url is required.';
if (empty($_POST['app_currency']))
$errors['app_currency'] = 'The application currency is required.';
if (empty($_POST['app_locale']))
$errors['app_locale'] = 'Please select a locale for the application.';
if (empty($_POST['app_timezone']))
$errors['app_timezone'] = 'The application timezone is required.';
if (empty($_POST['host_name']))
$errors['host_name'] = 'Host Name is required.';
if (empty($_POST['port_name']))
$errors['port_name'] = 'Port Name is required.';
if (preg_match('/\s/', $_POST['app_url']))
$errors['app_url_space'] = 'There should be no space in App URL ';
if (preg_match('/\s/', $_POST['app_name']))
$errors['app_name_space'] = 'There should be no space in App Name.';
if (preg_match('/\s/', $_POST['host_name']))
$errors['host_name_space'] = 'There should be no space in Host Name.';
if (preg_match('/\s/', $_POST['database_name']))
$errors['database_name_space'] = 'There should be no space in Database Name.';
if (preg_match('/\s/', $_POST['database_prefix']))
$errors['database_prefix_space'] = 'There should be no space in Database Prefix.';
if (preg_match('/\s/', $_POST['user_name']))
$errors['user_name_space'] = 'There should be no space in User Name.';
if (preg_match('/\s/', $_POST['user_password']))
$errors['user_password_space'] = 'There should be no space in User Password.';
if (preg_match('/\s/', $_POST['port_name']))
$errors['port_name_space'] = 'There should be no space in Port Name.';
// return a response
// if there are any errors in our errors array, return a success boolean of false
if (! empty($errors)) {
// if there are items in our errors array, return those errors
$data['success'] = false;
$data['errors'] = $errors;
} else {
// if there are no errors process our form, then return a message
// getting env file location
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$envFile = $desiredLocation . '/' . '.env';
$envExampleFile = $desiredLocation . '/' . '.env.example';
if (! file_exists($envFile)) {
if (file_exists($envExampleFile)) {
copy($envExampleFile, $envFile);
} else {
touch($envFile);
}
}
// reading env content
$data = file($envFile);
$keyValueData = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (strlen($line) !== 0) {
$keyValueData[$rowValues[0]] = $rowValues[1];
}
}
}
// inserting form data to empty array
$keyValueData['DB_HOST'] = $_POST["host_name"];
$keyValueData['DB_DATABASE'] = $_POST["database_name"];
$keyValueData['DB_PREFIX'] = $_POST["database_prefix"];
$keyValueData['DB_USERNAME'] = $_POST["user_name"];
$keyValueData['DB_PASSWORD'] = $_POST["user_password"];
$keyValueData['APP_NAME'] = $_POST["app_name"];
$keyValueData['APP_URL'] = $_POST["app_url"];
$keyValueData['APP_CURRENCY'] = $_POST["app_currency"];
$keyValueData['APP_LOCALE'] = $_POST["app_locale"];
$keyValueData['APP_TIMEZONE'] = $_POST["app_timezone"];
$keyValueData['DB_CONNECTION'] = $_POST["database_connection"];
$keyValueData['DB_PORT'] = $_POST["port_name"];
// making key/value pair with form-data for env
$changedData = [];
foreach ($keyValueData as $key => $value) {
$changedData[] = $key . '=' . $value;
}
// inserting new form-data to env
$changedData = implode(PHP_EOL, $changedData);
file_put_contents($envFile, $changedData);
// checking database connection(mysql only)
if ($_POST["database_connection"] == 'mysql') {
// create connection
@$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"], $_POST['port_name']);
// check connection
if ($conn->connect_error) {
$errors['database_error'] = $conn->connect_error;
$data['errors'] = $errors;
$data['success'] = false;
} else {
$data['success'] = true;
$data['message'] = 'Success!';
}
} else {
$data['success'] = true;
$data['message'] = 'Success!';
}
}
// return all our data to an AJAX call
echo json_encode($data);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="17px" height="13px" viewBox="0 0 17 13" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
<title>Check-Accent</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Desktop" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="requirment" transform="translate(-488.000000, -266.000000)">
<g id="Group-3" transform="translate(486.000000, 253.000000)">
<g id="Group-2" transform="translate(0.000000, 10.000000)">
<g id="Check-Accent">
<rect id="Rectangle-4" fill-rule="nonzero" x="0" y="0" width="20" height="20"></rect>
<polyline id="Path-2" stroke="#4CAF50" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" points="4 10 8 14 17 5"></polyline>
</g>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="13px" height="13px" viewBox="0 0 13 13" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
<title>Check-Accent Copy</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Desktop" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="requirment" transform="translate(-492.000000, -507.000000)">
<g id="Group-3" transform="translate(486.000000, 253.000000)">
<g id="Group-2" transform="translate(0.000000, 10.000000)">
<g id="Check-Accent-Copy" transform="translate(2.000000, 241.000000)">
<rect id="Rectangle-4-Copy-2" fill-rule="nonzero" x="0" y="0" width="20" height="20"></rect>
<path d="M6,14 L15,5" id="Path-2" stroke="#F44336" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M6,5 L15,14" id="Path-2" stroke="#F44336" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,15 +0,0 @@
<?php
ini_set('max_execution_time', 900);
$phpbin = PHP_BINDIR . '/php';
// array to pass back data
$data = [];
// run command on terminal and asumming that this is as fresh installation
$command = 'cd ../.. && '. $phpbin .' artisan config:cache && '. $phpbin.' artisan migrate:fresh --force';
$data['last_line'] = exec($command, $data['migrate'], $data['results']);
// return a response
// return all our data to an AJAX call
echo json_encode($data);

View File

@ -1,41 +0,0 @@
<?php
/* max execution time limit */
ini_set('max_execution_time', 900);
/* php bin path */
$phpbin = PHP_BINDIR . '/php';
/* commands sequence */
$commands = [
'seeder' => [
'key' => 'seeder_results',
'command' => 'cd ../.. && '. $phpbin .' artisan db:seed 2>&1'
],
'publish' => [
'key' => 'publish_results',
'command' => 'cd ../.. && '. $phpbin .' artisan vendor:publish --all --force 2>&1'
],
'storage_link' => [
'key' => 'storage_link_results',
'command' => 'cd ../.. && '. $phpbin .' artisan storage:link 2>&1'
],
'key' => [
'key' => 'key_results',
'command' => 'cd ../.. && '. $phpbin .' artisan key:generate 2>&1'
],
'optimize' => [
'key' => 'optimize_results',
'command' => 'cd ../.. && '. $phpbin .' artisan optimize 2>&1'
],
];
// run command on terminal
$data = [];
foreach ($commands as $key => $value) {
exec($value['command'], $data[$key], $data[$value['key']]);
}
// return a response
// return all our data to an AJAX call
echo json_encode($data);

View File

@ -1,119 +0,0 @@
<div class="container admin" id="admin">
<div class="initial-display">
<p>Create a Administrator</p>
</div>
<div class="row justify-content-center">
<div class="col-md-6 col-md-offset-1">
<div class="card card-default">
<div class="card-body">
<form action="AdminConfig.php" method= "POST" id="admin-form">
<div class="form-group" id="admin_name">
<label for="admin_user_name" class="required">Name</label>
<input type="text" name="admin_name" id="admin_user_name" class="form-control" data-validation="required length" data-validation-length="max50">
</div>
<div class="form-group" id="admin_email">
<label for="admin_user_email" class="required">Email</label>
<input type="text" name="admin_email" id="admin_user_email" class="form-control" data-validation="required email length" data-validation-length="max50">
</div>
<div class="form-group" id="admin_password">
<label for="admin_user_password" class="required">Password</label>
<input type="password" name="admin_password" id="admin_user_password" class="form-control" data-validation="length required" data-validation-length="min6">
</div>
<div class="form-group" id="admin_re_password">
<label for="admin_user_repassword" class="required">Password confirmation</label>
<input type="password" name="admin_re_password" id="admin_user_repassword" class="form-control" data-validation="length required" data-validation-length="min6">
</div>
<div class="text-center" style="padding-bottom: 10px;">
<button type="submit" class="btn btn-primary" id="admin-check">Continue</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$.validate({});
// process the form
$('#admin-form').submit(function(event) {
$('.form-group').removeClass('has-error'); // remove the error class
$('.form-error').remove(); // remove the error text
// get the form data
var formData = {
'admin_email' : $('input[name=admin_email]').val(),
'admin_name' : $('input[name=admin_name]').val(),
'admin_password' : $('input[name=admin_password]').val(),
'admin_re_password' : $('input[name=admin_re_password]').val(),
};
var adminTarget = window.location.href.concat('/AdminConfig.php');
// process the form
$.ajax({
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
url : adminTarget, // the url where we want to POST
data : formData, // our data object
dataType : 'json', // what type of data do we expect back from the server
encode : true
})
// using the done promise callback
.done(function(data) {
if (!data.success) {
// handle errors
if (data.errors.admin_email) {
$('#admin_email').addClass('has-error');
$('#admin_email').append('<div class="form-error">' + data.errors.admin_email + '</div>');
}
if (data.errors.admin_name) {
$('#admin_name').addClass('has-error');
$('#admin_name').append('<div class="form-error">' + data.errors.admin_name + '</div>');
}
if (data.errors.admin_password) {
$('#admin_password').addClass('has-error');
$('#admin_password').append('<div class="form-error">' + data.errors.admin_password + '</div>');
}
if (data.errors.admin_re_password) {
$('#admin_re_password').addClass('has-error');
$('#admin_re_password').append('<div class="form-error">' + data.errors.admin_re_password + '</div>');
}
if (data.errors.password_match) {
$('#admin_re_password').addClass('has-error');
$('#admin_password').addClass('has-error');
$('#admin_re_password').append('<div class="form-error">' + data.errors.password_match + '</div>');
$('#admin_password').append('<div class="form-error">' + data.errors.password_match + '</div>');
}
} else {
// error handling for database
// connection error
if (data['connection']) {
alert(data['connection']);
}
// insert error
if (data['insert_fail']) {
alert(data['insert_fail']);
}
// Database support error
if (data['support_error']) {
result = confirm(data['support_error']);
if (result) {
$('#admin').hide();
$('#email').show();
}
}
if (!data['connection'] && !data['insert_fail'] && !data['support_error']) {
$('#admin').hide();
$('#email').show();
}
}
});
// stop the form from submitting the normal way and refreshing the page
event.preventDefault();
});
});
</script>

View File

@ -1,136 +0,0 @@
<div class="container email" id="email">
<div class="initial-display">
<p>Email Configuration</p>
</div>
<div class="row justify-content-center">
<div class="col-md-6 col-md-offset-1">
<div class="card card-default">
<div class="card-body">
<form action="EmailConfig.php" method= "POST" id="email-form">
<input type="hidden" name="mail_driver" value="smtp">
<div class="form-row">
<div class="form-group col-md-6" id="mail_host">
<label for="mail_hostname" class="required">Outgoing mail server</label>
<input type="text" name="mail_host" id="mail_hostname" class="form-control" placeholder="smtp.mailtrap.io" data-validation="required">
</div>
<div class="form-group col-md-6" id="mail_port">
<label for="mail_portnumber" class="required">Server port</label>
<input type="text" name="mail_port" id="mail_portnumber" class="form-control" placeholder="2525" data-validation="required">
</div>
</div>
<div class="form-group" id="mail_encryption">
<label for="mail_encrypt">Encryption</label>
<select name="mail_encryption" id="mail_encrypt" class="form-control">
<option value="ssl">SSL</option>
<option value="tls">TLS</option>
<option value="">None</option>
</select>
</div>
<div class="form-group" id="mail_from">
<label for="email_from" class="required">Store email address</label>
<input type="text" name="mail_from" id="email_from" class="form-control" placeholder="store@example.com" data-validation="required">
</div>
<div class="form-group" id="mail_username">
<label for="email_username" class="required">Username</label>
<input type="text" name="mail_username" id="email_username" class="form-control" placeholder="store@example.com" data-validation="required">
</div>
<div class="form-group" id="mail_password">
<label for="email_password" class="required">Password</label>
<input type="password" name="mail_password" id="email_password" class="form-control" data-validation="required">
</div>
<div class="text-center">
<button class="btn btn-primary" id="mail-check">Save configuration</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$.validate({});
</script>
<script>
$(document).ready(function() {
$('#email').hide();
// process the form
$('#email-form').submit(function(event) {
$('.form-group').removeClass('has-error'); // remove the error class
$('.form-error').remove(); // remove the error text
// get the form data
var mailformData = {
'mail_driver' : $('input[name=mail_driver]').val(),
'mail_host' : $('input[name=mail_host]').val(),
'mail_port' : $('input[name=mail_port]').val(),
'mail_from' : $('input[name=mail_from]').val(),
'mail_username' : $('input[name=mail_username]').val(),
'mail_password' : $('input[name=mail_password]').val(),
'mail_encryption' : $('select[name=mail_encryption]').val(),
};
var EmailTarget = window.location.href.concat('/EmailConfig.php');
$.ajax({type : 'POST', url : EmailTarget, data : mailformData, dataType : 'json', encode : true})
.done(function(data) {
if (!data.success) {
// handle errors
if (data.errors.mail_driver) {
$('#mail_driver').addClass('has-error');
$('#mail_driver').append('<div class="form-error">' + data.errors.mail_driver + '</div>');
}
if (data.errors.mail_host) {
$('#mail_host').addClass('has-error');
$('#mail_host').append('<div class="form-error">' + data.errors.mail_host + '</div>');
}
if (data.errors.mail_port) {
$('#mail_port').addClass('has-error');
$('#mail_port').append('<div class="form-error">' + data.errors.mail_port + '</div>');
}
if (data.errors.mail_from) {
$('#mail_from').addClass('has-error');
$('#mail_from').append('<div class="form-error">' + data.errors.mail_from + '</div>');
}
if (data.errors.mail_username) {
$('#mail_username').addClass('has-error');
$('#mail_username').append('<div class="form-error">' + data.errors.mail_username + '</div>');
}
if (data.errors.mail_password) {
$('#mail_password').addClass('has-error');
$('#mail_password').append('<div class="form-error">' + data.errors.mail_password + '</div>');
}
} else {
$('#admin').hide();
$('#email').hide();
$('#finish').show();
var removeInstaller = window.location.href.concat('/Cleanup.php');
$.ajax({
type : 'POST',
url : removeInstaller,
dataType : 'json',
encode : true
}).done(function(data) {
console.log('The installation folder have been removed.')
});
}
});
// stop the form from submitting the normal way and refreshing the page
event.preventDefault();
});
});
</script>

View File

@ -1,259 +0,0 @@
<div class="container environment" id="environment">
<div class="initial-display">
<p>Environment Configuration</p>
</div>
<div class="row justify-content-center">
<div class="col-md-6 col-md-offset-1">
<div class="card card-default">
<div class="card-body">
<form action="EnvConfig.php" method="POST" id="environment-form">
<div id="app-settings">
<div class="form-group" id="app_name">
<label for="application_name" class="required">Application Name</label>
<input type= "text" name= "app_name" id="application_name" class="form-control" value="Bagisto_" data-validation="required length"
data-validation-length="max20">
</div>
<div class="form-group" id="app_url">
<label for="application_url" class="required">Default URL</label>
<input type="text" name="app_url" id="application_url" class="form-control" value="https://<?php echo $_SERVER['HTTP_HOST']; ?>"
data-validation="required length" data-validation-length="max50">
</div>
<div class="form-group" id="app_currency">
<label for="application_currency" class="required">Default Currency</label>
<select name="app_currency" id="application_currency" class="form-control" data-validation="required length" data-validation-length="max50">
<option value="EUR">Euro</option>
<option value="USD" selected>US Dollar</option>
</select>
</div>
<div class="form-group" id="app_timezone">
<label for="application_timezone" class="required">Default Timezone</label>
<select name="app_timezone" id="application_timezone" class="js-example-basic-single">
<?php
date_default_timezone_set('UTC');
$tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
$current = date_default_timezone_get();
foreach($tzlist as $key => $value) {
if(!$value === $current) {
echo "<option value='$value' selected>" . $value . "</option>";
} else {
echo "<option value='$value'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group" id="app_locale">
<label for="application_locale" class="required">Default Locale</label>
<select name="app_locale" id="application_locale" class="form-control" data-validation="required">
<option value="nl">Dutch</option>
<option value="en" selected>English</option>
<option value="fr">French</option>
<option value="es">Español</option>
</select>
</div>
<div class="text-center">
<button type="button" class="btn btn-primary" id="environment-next">Continue</button>
<button type="button" class="btn btn-secondary" id="envronment-back">Go back</button>
</div>
</div>
<div id="database-settings">
<div class="databse-error" id="database_error"></div>
<div class="form-group" id="database_connection">
<label for="db_connection" class="required">Database Connection</label>
<select name="database_connection" id="db_connection" class="form-control">
<option value="mysql" selected>Mysql</option>
<option value="sqlite">SQlite</option>
<option value="pgsql">pgSQL</option>
<option value="sqlsrv">SQLSRV</option>
</select>
</div>
<div class="form-row">
<div class="form-group col-md-6" id="host_name">
<label for="db_hostname" class="required">Database Hostname</label>
<input type="text" name="host_name" id="db_hostname" class="form-control" value="127.0.0.1"
data-validation="required length" data-validation-length="max50">
</div>
<div class="form-group col-md-6" id="port_name">
<label for="db_port" class="required">Database Port</label>
<input type="text" name="port_name" id="db_port" class="form-control" value="3306"
data-validation="required alphanumeric number length" data-validation-length="max5">
</div>
</div>
<div class="form-group" id="database_name">
<label for="db_name" class="required">Database Name</label>
<input type="text" name="database_name" id="db_name" class="form-control"
data-validation="length required" data-validation-length="max50">
</div>
<div class="form-group" id="database_prefix">
<label for="database_prefix">Database Prefix</label>
<input type="text" name="database_prefix" id="database_prefix" class="form-control"
data-validation="length" data-validation-length="max50">
</div>
<div class="form-group" id="user_name">
<label for="db_username" class="required">Database Username</label>
<input type="text" name="user_name" id="db_username" class="form-control"
data-validation="length required" data-validation-length="max50">
</div>
<div class="form-group" id="user_password">
<label for="db_password" class="required">Database Password</label>
<input type="password" name="user_password" id="db_password" class="form-control" data-validation="required">
</div>
<div class="text-center">
<button class="btn btn-primary" id="environment-check">Save & Continue</button>
<button type="button" class="btn btn-secondary" id="environment-first">Go back</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.js-example-basic-single').select2({
theme: 'bootstrap4'
});
$.validate({});
$('#database-settings').hide();
$('#environment-next').click(function() {
$('#app-settings').hide();
$('#database-settings').show();
});
$('#environment-first').click(function() {
$('#app-settings').show();
$('#database-settings').hide();
});
// process the form
$('#environment-form').submit(function(event) {
$('.control-group').removeClass('has-error'); // remove the error class
$('.form-error').remove(); // remove the error text
// get the form data
let formData = {
'app_name' : $('input[name=app_name]').val(),
'app_url' : $('input[name=app_url]').val(),
'app_currency' : $('select[name=app_currency]').val(),
'app_locale' : $('select[name=app_locale]').val(),
'app_timezone' : $('select[name=app_timezone]').val(),
'host_name' : $('input[name=host_name]').val(),
'port_name' : $('input[name=port_name]').val(),
'database_connection' : $("select[name=database_connection]" ).val(),
'database_name' : $('input[name=database_name]').val(),
'database_prefix' : $('input[name=database_prefix]').val(),
'user_name' : $('input[name=user_name]').val(),
'user_password' : $('input[name=user_password]').val(),
};
let target = window.location.href.concat('/EnvConfig.php');
// process the form
$.ajax({
type : 'POST',
url : target,
data : formData,
dataType : 'json',
encode : true
})
// using the done promise callback
.done(function(data) {
if (!data.success) {
// handle errors
if (data.errors.app_name) {
$('#app_name').addClass('has-error');
$('#app_name').append('<div class="form-error">' + data.errors.app_name + '</div>');
}
if (data.errors.app_url) {
$('#app_url').addClass('has-error');
$('#app_url').append('<div class="form-error">' + data.errors.app_url + '</div>');
}
if (data.errors.app_timezone) {
$('#app_timezone').addClass('has-error');
$('#app_timezone').append('<div class="form-error">' + data.errors.app_timezone + '</div>');
}
if (data.errors.host_name) {
$('#host_name').addClass('has-error');
$('#host_name').append('<div class="form-error">' + data.errors.host_name + '</div>');
}
if (data.errors.port_name) {
$('#port_name').addClass('has-error');
$('#port_name').append('<div class="form-error">' + data.errors.port_name + '</div>');
}
if (data.errors.user_name) {
$('#user_name').addClass('has-error');
$('#user_name').append('<div class="form-error">' + data.errors.user_name + '</div>');
}
if (data.errors.database_name) {
$('#database_name').addClass('has-error');
$('#database_name').append('<div class="form-error">' + data.errors.database_name + '</div>');
}
if (data.errors.user_password) {
$('#user_password').addClass('has-error');
$('#user_password').append('<div class="form-error">' + data.errors.user_password + '</div>');
}
if (data.errors.app_url_space) {
$('#app_url').addClass('has-error');
$('#app_url').append('<div class="form-error">' + data.errors.app_url_space + '</div>');
}
if (data.errors.app_name_space) {
$('#app_name').addClass('has-error');
$('#app_name').append('<div class="form-error">' + data.errors.app_name_space + '</div>');
}
if (data.errors.host_name_space) {
$('#host_name').addClass('has-error');
$('#host_name').append('<div class="form-error">' + data.errors.host_name_space + '</div>');
}
if (data.errors.port_name_space) {
$('#port_name').addClass('has-error');
$('#port_name').append('<div class="form-error">' + data.errors.port_name_space + '</div>');
}
if (data.errors.user_name_space) {
$('#user_name').addClass('has-error');
$('#user_name').append('<div class="form-error">' + data.errors.user_name_space + '</div>');
}
if (data.errors.database_name_space) {
$('#database_name').addClass('has-error');
$('#database_name').append('<div class="form-error">' + data.errors.database_name_space + '</div>');
}
if (data.errors.database_prefix_space) {
$('#database_prefix').addClass('has-error');
$('#database_prefix').append('<div class="form-error">' + data.errors.database_prefix_space + '</div>');
}
if (data.errors.user_password_space) {
$('#user_password').addClass('has-error');
$('#user_password').append('<div class="form-error">' + data.errors.user_password_space + '</div>');
}
if (data.errors.database_error) {
$('#database_error').append('<div class="form-error">' + data.errors.database_error + '</div>');
}
} else {
$('#environment').hide();
$('#migration').show();
}
});
// stop the form from submitting the normal way and refreshing the page
event.preventDefault();
});
});
</script>

View File

@ -1,32 +0,0 @@
<div class="container finish" id="finish">
<div class="initial-display">
<p>Installation completed</p>
</div>
<div class="row justify-content-center">
<div class="col-md-7">
<div class="card card-default">
<div class="card-body">
<div class="alert alert-success">
<b>Bagisto</b> is successfully installed on your system.<br>
</div>
</div>
</div>
<div class="clearfix">&nbsp;</div>
<div class="" role="toolbar" aria-label="buttons">
<button class="btn btn-primary" onclick="finish()">Launch the admin interface</button>
<a href="https://bagisto.com/en/extensions/" class="btn btn-secondary" target="_blank">Bagisto Extensions</a>
<a href="https://forums.bagisto.com/" class="btn btn-secondary" target="_blank">Bagisto Forums</a>
</div>
</div>
</div>
</div>
<script>
function finish() {
next = window.location.href.split("/installer")[0];
next = next.concat('/admin/login');
window.location.href = next;
}
</script>

View File

@ -1,232 +0,0 @@
<style>
.window {
max-height: 488px;
background: #222;
color: #fff;
overflow: hidden;
position: relative;
margin: 0 auto;
width: 100%;
&:before {
content: ' ';
display: block;
height: 48px;
background: #C6C6C6;
}
&:after {
content: '. . .';
position: absolute;
left: 12px;
right: 0;
top: -3px;
font-family: "Times New Roman", Times, serif;
font-size: 96px;
color: #fff;
line-height: 0;
letter-spacing: -12px;
}
}
.terminal {
margin: 20px;
font-family: monospace;
font-size: 16px;
color: #22da26;
max-height: 488px;
.command {
width: 0%;
white-space: nowrap;
overflow: hidden;
animation: write-command 5s both;
&:before {
content: '$ ';
color: #22da26;
}
}
}
</style>
<div class="container migration" id="migration">
<div class="initial-display">
<p>Ready for installation</p>
</div>
<div class="row justify-content-center">
<div class="col-md-6 col-md-offset-1">
<div class="card card-default">
<div class="card-body" id="migration-result">
<div class="cp-spinner cp-round" id="loader"></div>
<div id="install-log">
<label for="install-details">Installation log</label>
<textarea rows="15" id="install-details" class="form-control"></textarea>
</div>
<div class="instructions" style="padding-top: 40px;" id="instructions">
<div style="text-align: center;">
<h4>Click the button below to:</h4>
</div>
<div class="message">
<span>Create the database tables</span>
</div>
<div class="message">
<span>Populate the database tables </span>
</div>
<div class="message">
<span>Publishing the vendor files</span>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<p class="composer" id="comp">Checking Composer dependencies</p>
<p class="composer" id="composer-migrate">Creating the database tables, this can take a few moments.</p>
<p class="composer" id="composer-seed">Populating the database tables</p>
</div>
</div>
<div class="clearfix">&nbsp;</div>
<form method="POST" id="migration-form">
<div style="text-align: center;">
<button class="btn btn-primary" id="migrate-seed">Start installation</button>
<button type="button" class="btn btn-primary" id="continue">Continue</button>
</div>
<div style="cursor: pointer; margin-top:10px">
<span id="migration-back">back</span>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('#continue').hide();
$('#loader').hide();
$('#install-log').hide();
// process the form
$('#migration-form').submit(function(event) {
// showing loader & hiding migrate button
$('#loader').show();
$('#comp').show();
$('#instructions').hide();
$('#migrate-seed').hide();
$('#migration-back').hide();
$('#migrate').hide();
$('#seed').hide();
$('#publish').hide();
$('#storage').hide();
$('#composer').hide();
var composerTarget = window.location.href.concat('/Composer.php');
// process form
$.ajax({
type : 'POST',
url : composerTarget,
dataType : 'json',
encode : true
})
.done(function(data) {
if (data) {
$('#comp').hide();
$('#seed').show();
$('#publish').show();
$('#storage').show();
$('#composer').show();
if (data['install'] == 0) {
$('#composer-migrate').show();
var migrationTarget = window.location.href.concat('/MigrationRun.php');
// post the request again
$.ajax({
type : 'POST',
url : migrationTarget,
dataType : 'json',
encode : true
})
// using the done promise callback
.done(function(data) {
if (data) {
$('#composer-migrate').hide();
if (data['results'] == 0) {
$('#composer-seed').show();
var seederTarget = window.location.href.concat('/Seeder.php');
$.ajax({
type : 'POST',
url : seederTarget,
dataType : 'json',
encode : true
})
// using the done promise callback
.done(function(data) {
$('#composer-seed').hide();
$('#install-log').show();
if (data['seeder']) {
$('#install-details').append(data['seeder']);
}
if (data['publish']) {
$('#install-details').append(data['publish']);
}
if (data['key']) {
$('#install-details').append(data['key']);
}
if ((data['key_results'] == 0) && (data['seeder_results'] == 0) && (data['publish_results'] == 0)) {
$('#continue').show();
$('#migrate-seed').hide();
$('#loader').hide();
};
});
} else {
$('#migrate').show();
$('#loader').hide();
$('#migrate-seed').hide();
$('#migration-back').hide();
if (data['migrate']) {
$('#install-details').append(data['migrate']);
$('#install-log').show();
}
}
}
});
} else {
$('#loader').hide();
$('#composer-migrate').hide();
$('#migrate-seed').hide();
$('#migration-back').hide();
$('#install-details').append(data['composer']);
$('#install-log').show();
}
}
});
// stop the form from submitting the normal way and refreshing the page
event.preventDefault();
});
});
</script>

View File

@ -1,66 +0,0 @@
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$greenCheck = $actual_link .'/'. 'Images/green-check.svg';
$redCheck = $actual_link .'/'. 'Images/red-check.svg';
?>
<div class="container requirement" id="requirement">
<div class="initial-display">
<p>Server Requirements</p>
</div>
<div class="row justify-content-center">
<div class="col-md-6 col-md-offset-1">
<div class="card card-default">
<div class="card-body">
<ul class="requirements_list">
<li>
<?php if($phpVersion['supported'] ? $src = $greenCheck : $src = $redCheck): ?>
<img src="<?php echo $src ?>">
<?php endif; ?>
<span><b>PHP</b></span>
<small>(<?php echo $phpVersion['minimum'] ?> or higher)</small>
<br>
<?php if(!($phpVersion['supported'] == 1)): ?>
<small style="color: red;">
Bagisto has detected that your PHP version (<?php echo $phpVersion['current']; ?>) is not supported.<br>
Contact your provider if you are not the server administrator.
</small>
<?php endif; ?>
</li>
<?php foreach($requirements['requirements'] as $type => $require): ?>
<?php foreach($requirements['requirements'][$type] as $extention => $enabled) : ?>
<li>
<?php if($enabled ? $src = $greenCheck : $src = $redCheck ): ?>
<img src="<?php echo $src ?>">
<?php endif; ?>
<span><b><?php echo $extention ?></b></span>
</li>
<?php endforeach; ?>
<?php endforeach; ?>
<li>
<?php if(($composerInstall['composer_install'] == 0) ? $src = $greenCheck : $src = $redCheck ): ?>
<img src="<?php echo $src ?>">
<span><b>composer</b></span>
<?php endif; ?>
<br>
<?php if(!($composerInstall['composer_install'] == 0)): ?>
<small style="color: red;">
<?php echo $composerInstall['composer'] ?>
</small>
<?php endif; ?>
</li>
</ul>
<?php if(!isset($requirements['errors']) && ($phpVersion['supported'] && $composerInstall['composer_install'] == 0)): ?>
<div class="text-center"><button type="button" class="btn btn-primary" id="requirement-check">Continue</button></div>
<?php elseif(!($phpVersion['supported'] && $composerInstall['composer_install'] == 0)): ?>
<div class="text-center"><button type="button" class="btn btn-primary" id="requirements-refresh">Refresh</button></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,44 +0,0 @@
<html>
<body>
<div class="container welcome" id="welcome">
<div class="initial-display">
<p>Welcome to Bagisto</p>
<div class="content">
<div class="content-container" style="padding: 20px">
<span>
Have you ever heard of an old saying, “No man is an island”? We probably heard that a million times. That saying is actually true because when we became successful, we usually achieve that because someone has helped us. And our thank-you speech skills could be the best thing we can do in return. You may also see
</span>
<div class="title">
INTRODUCTION
</div>
<span>
Have you ever heard of an old saying, “No man is an island”? We probably heard that a million times. That saying is actually true because when we became successful, we usually achieve that because someone has helped us. And our thank-you speech skills could be the best thing we can do in return. You may also see
</span>
</div>
</div>
<div>
<button type="button" class="prepare-btn" id="welcome-check">Accept</button>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,138 +0,0 @@
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$cssUrl = $actual_link . '/' . 'CSS/style.css';
$logo = $actual_link . '/' . 'Images/logo.svg';
$jsURL = $actual_link . '/' . 'js/script.js';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Bagisto Installer</title>
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $cssUrl; ?>">
</head>
<body>
<div class="container">
<div class="initial-display">
<img class="logo" src="<?php echo $logo; ?>">
</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
$data = file($envFile);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION', 'DB_PORT', 'DB_PREFIX'];
$key = $value = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (strlen($line) !== 0) {
if (in_array($rowValues[0], $databaseArray)) {
$key[] = $rowValues[0];
$value[] = $rowValues[1];
}
}
}
}
$databaseData = array_combine($key, $value);
$servername = $databaseData['DB_HOST'] ?? '';
$username = $databaseData['DB_USERNAME'] ?? '';
$password = $databaseData['DB_PASSWORD'] ?? '';
$dbPrefix = $databaseData['DB_PREFIX'] ?? '';
$dbname = $databaseData['DB_DATABASE'] ?? '';
$port = $databaseData['DB_PORT'] ?? '';
$connection = $databaseData['DB_CONNECTION'] ?? '';
if (isset($connection) && $connection == 'mysql') {
@$conn = new mysqli($servername, $username, $password, $dbname, (int) $port);
if (! $conn->connect_error) {
// retrieving admin entry
$prefix = $dbPrefix . 'admins';
$sql = "SELECT id, name FROM $prefix";
$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__ . '/Views/environment.blade.php';
include __DIR__ . '/Views/migration.blade.php';
include __DIR__ . '/Views/admin.blade.php';
include __DIR__ . '/Views/email.blade.php';
include __DIR__ . '/Views/finish.blade.php';
// object creation
$requirement = new Requirement();
echo $requirement->render();
} 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");
}
?>
<div style="margin-bottom: 5px; margin-top: 30px; text-align: center;">
<a href="https://bagisto.com/" target="_blank">Bagisto</a> a community project by <a href="https://webkul.com/" target="_blank">Webkul</a>
</div>
<script src="<?php echo $jsURL; ?>"></script>
</body>
</html>

View File

@ -1,89 +0,0 @@
<?php declare(strict_types = 0);
// getting env file
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$envFile = $desiredLocation . '/' . '.env';
$installed = false;
if (file_exists($envFile)) {
// reading env content
$data = file($envFile);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT', 'DB_PREFIX'];
$key = $value = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (strlen($line) !== 0) {
if (in_array($rowValues[0], $databaseArray)) {
$key[] = $rowValues[0];
$value[] = $rowValues[1];
}
}
}
}
$databaseData = array_combine($key, $value);
if (isset($databaseData['DB_HOST'])) {
$servername = $databaseData['DB_HOST'];
}
if (isset($databaseData['DB_USERNAME'])) {
$username = $databaseData['DB_USERNAME'];
}
if (isset($databaseData['DB_PASSWORD'])) {
$password = $databaseData['DB_PASSWORD'];
}
if (isset($databaseData['DB_DATABASE'])) {
$dbname = $databaseData['DB_DATABASE'];
}
if (isset($databaseData['DB_CONNECTION'])) {
$connection = $databaseData['DB_CONNECTION'];
}
if (isset($databaseData['DB_PORT'])) {
$port = $databaseData['DB_PORT'];
}
if (isset($connection) && $connection == 'mysql') {
@$conn = new mysqli($servername, $username, $password, $dbname, (int)$port);
if (! $conn->connect_error) {
// retrieving admin entry
$prefix = $databaseData['DB_PREFIX'].'admins';
$sql = "SELECT id, name FROM $prefix";
$result = $conn->query($sql);
if ($result) {
$installed = true;
}
}
$conn->close();
} else {
$installed = true;
}
}
if (! $installed) {
// 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);
$url = implode("/", $url);
$url = $url . '/installer';
return $url;
} else {
return null;
}
?>

View File

@ -1,85 +0,0 @@
window.onload = function() {
var welcome = document.getElementById('welcome');
var requirement = document.getElementById('requirement');
var environment = document.getElementById('environment');
var migration = document.getElementById('migration');
var admin = document.getElementById('admin');
var welcomeCheck = document.getElementById('welcome-check');
var requirementCheck = document.getElementById('requirement-check');
var requirementsRefresh = document.getElementById('requirements-refresh');
var permisssionCheck = document.getElementById('permission-check');
var environmentCheck = document.getElementById('environment-check');
var continue_to_admin = document.getElementById('continue');
var permissionBack = document.getElementById('permission-back');
var requirementBack = document.getElementById('requirement-back');
var envBack = document.getElementById('envronment-back');
var migrationBack = document.getElementById('migration-back');
if (requirementCheck) {
requirementCheck.addEventListener('click', myFunction);
}
if (requirementsRefresh) {
requirementsRefresh.addEventListener('click', myFunction);
}
if (welcomeCheck) {
welcomeCheck.addEventListener('click', myFunction);
}
if (permisssionCheck) {
permisssionCheck.addEventListener('click', myFunction);
}
if (environmentCheck) {
environmentCheck.addEventListener('click', myFunction);
}
if (continue_to_admin) {
continue_to_admin.addEventListener('click', myFunction);
}
if (envBack) {
envBack.addEventListener('click', myFunction);
}
if (requirementBack) {
requirementBack.addEventListener('click', myFunction);
}
if (permissionBack) {
permissionBack.addEventListener('click', myFunction);
}
if (migrationBack) {
migrationBack.addEventListener('click', myFunction);
}
function myFunction() {
if(this.id == 'welcome-check') {
requirement.style.display = "block";
welcome.style.display = "none";
} else if (this.id == 'requirement-check') {
environment.style.display = "block";
requirement.style.display = "none";
} else if (this.id == 'continue') {
migration.style.display = "none";
admin.style.display ="block";
} else if (this.id == 'requirement-back') {
welcome.style.display = "block";
requirement.style.display = "none";
} else if (this.id == 'envronment-back') {
environment.style.display ="none";
requirement.style.display = "block";
} else if (this.id == 'migration-back') {
migration.style.display = "none";
environment.style.display ="block";
} else if (this.id == 'requirements-refresh') {
location.reload();
}
}
};