add login

This commit is contained in:
baghizadizn 2025-11-25 15:12:17 +07:00
parent 4f50bb7c04
commit 979fa95f36
11 changed files with 140 additions and 232 deletions

View File

@ -1,193 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\FileUploader;
use Artisan;
//database migration
use DB;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use ZipArchive;
class Updater extends Controller
{
public function update(Request $request)
{
$addons_parent_id = null;
$rules = array('file' => 'required|file|mimes:zip');
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return redirect()->back()->with('error', get_phrase('Select a valid zip file'));
}
//Create update directory
$dir = 'upload';
if (!is_dir($dir) && !file_exists($dir)) {
mkdir($dir, 0777, true);
}
//Uploaded file name
$file_name = $request->file->getClientOriginalName();
$path = $dir . '/' . $file_name;
if (class_exists('ZipArchive')) {
//File uploading..
FileUploader::upload($request->file, '../'.$path);
// Unzip uploaded update file and remove zip file.
$zip = new ZipArchive;
$res = $zip->open(base_path($path));
$zip->extractTo(base_path($dir));
$zip->close();
unlink(base_path($path));
} else {
return redirect()->back()->with('error', get_phrase('Your server is unable to extract the zip file') . '. ' . get_phrase('Please enable the zip extension to the server, then try again'));
}
$uploaded_folder_name = substr($file_name, 0, -4);
$version_ = substr($file_name, 0, -4);
// Exicute php or laravel's code
$step1Exicution = file_get_contents(base_path($dir . '/' . $uploaded_folder_name . '/step1_pre_checker.php'));
if ($step1Exicution) {
eval($step1Exicution);
}
//check required version
$product_current_version = DB::table('settings')->where('type', 'version')->value('description');
$config = file_get_contents(base_path($dir . '/' . $uploaded_folder_name . '/step2_config.json'));
if ($config) {
$config = json_decode($config, true);
}
//check ias addon or main product update
if (array_key_exists('is_addon', $config) && strval($config['is_addon']) == "1") {
//check required main product version to install this addon
if ($config['product_version']['minimum_required_version'] > $product_current_version) {
return redirect()->back()->with('error', get_phrase("You have to update your main application's version.") . '(' . $config['product_version']['minimum_required_version'] . ') ' . get_phrase(' to install the addon'));
}
$addons_current_version = DB::table('addons')->where('unique_identifier', $config['addons'][0]['unique_identifier']);
if ($addons_current_version->get()->count() > 0) {
$addons_current_version = $addons_current_version->value('version');
} else {
$addons_current_version = "0";
}
//check required addon version to update this addon
if (strval($config['addon_version']['minimum_required_version']) != strval($addons_current_version)) {
return redirect()->back()->with('error', get_phrase('It looks like you are skipping a version') . '. ' . get_phrase('Please update version') . ' ' . $config['addon_version']['minimum_required_version'] . ' ' . get_phrase('first'));
}
foreach ($config['addons'] as $addon) {
$data['unique_identifier'] = $addon['unique_identifier'];
$data['title'] = $addon['title'];
$data['version'] = $config['addon_version']['update_version'];
$data['features'] = $addon['features'];
$data['status'] = 1;
$data['parent_id'] = $addons_parent_id;
$parent_id = DB::table('addons')->insertGetId($data);
if ($addons_parent_id == null) {
$addons_parent_id = $parent_id;
}
}
} else {
//check required main product version
if (strval($config['product_version']['minimum_required_version']) != strval($product_current_version)) {
return redirect()->back()->with('error', get_phrase('It looks like you are skipping a version') . '. ' . get_phrase('Please update version') . ' ' . $config['product_version']['minimum_required_version'] . ' ' . get_phrase('first'));
}
}
//Update files, folders and libraries
$this->fileAndFolderDistributor($uploaded_folder_name);
//run SQL file
$sql = file_get_contents(base_path($dir . '/' . $uploaded_folder_name . '/step3_database.sql'));
if ($sql) {
DB::unprepared($sql);
}
// Exicute php or laravel's code
$step4Exicution = file_get_contents(base_path($dir . '/' . $uploaded_folder_name . '/step4_update_data.php'));
if ($step4Exicution) {
eval($step4Exicution);
}
if (array_key_exists('is_addon', $config) && strval($config['is_addon']) == "1") {
if ($config['addon_version']['minimum_required_version'] == "0") {
return redirect()->back()->with('success', get_phrase('Addon installed successfully'));
} else {
return redirect()->back()->with('success', get_phrase('Addon updated successfully'));
}
} else {
DB::table('settings')->where('type', 'version')->update(['description' => $config['product_version']['update_version']]);
return redirect()->back()->with('success', get_phrase('Version updated successfully'));
}
}
public function fileAndFolderDistributor($param1, $param2 = "")
{
if ($param2 == "") {
$param2 = $param1;
$uploaded_dir_path = base_path('upload/' . $param1 . '/sources');
} else {
$uploaded_dir_path = $param1;
}
$uploaded_dir_paths = glob($uploaded_dir_path . '/*');
foreach ($uploaded_dir_paths as $uploaded_sub_dir_path) {
if (is_dir($uploaded_sub_dir_path)) {
$all_available_sub_paths = count(glob($uploaded_sub_dir_path . '/*'));
if ($all_available_sub_paths == 0) {
//Create directory
$application_dir_path = str_replace('upload/' . $param2 . '/sources/', "", $uploaded_sub_dir_path);
if (!is_dir($application_dir_path) && !file_exists($application_dir_path)) {
mkdir($application_dir_path, 0777, true);
}
} else {
$this->fileAndFolderDistributor($uploaded_sub_dir_path, $param2);
}
} else {
$application_file_path = str_replace('upload/' . $param2 . '/sources/', "", $uploaded_sub_dir_path);
//Check dir. If not exist then created
$file_path_arr = explode("/", $application_file_path);
$file_name = $file_path_arr[count($file_path_arr) - 1];
$application_dir_path = str_replace('/' . $file_name, "", $application_file_path);
if (!is_dir($application_dir_path) && !file_exists($application_dir_path)) {
mkdir($application_dir_path, 0777, true);
}
//Copy file to application path
copy($uploaded_sub_dir_path, $application_file_path);
//Zip file extract for any big size libraries
if (pathinfo($file_name, PATHINFO_EXTENSION) == 'zip') {
// PATH OF EXTRACTING LIBRARY FILE
array_pop($file_path_arr);
$extract_to = implode('/', $file_path_arr);
$library_zip = new ZipArchive;
$library_result = $library_zip->open($application_file_path);
$library_zip->extractTo($extract_to);
$library_zip->close();
unlink($application_file_path);
}
}
}
}
}

View File

@ -351,6 +351,82 @@ img {
border-radius: 24px !important; border-radius: 24px !important;
} }
.divider {
display: flex;
align-items: center;
text-align: center;
margin: 20px 0;
}
.divider::before,
.divider::after {
content: '';
flex: 1;
border-bottom: 1px solid #ddd;
}
.divider span {
padding: 0 15px;
color: #666;
font-size: 14px;
background: white;
}
.hover-color-2 {
transition: color 0.3s ease, font-weight 0.1 ease-in-out;
}
.hover-color-1:hover {
color: var(--color-1);
cursor: pointer;
}
.hover-color-2:hover {
color: black;
cursor: pointer;
}
.google-login-btn {
display: flex !important;
align-items: center;
justify-content: center;
padding: 12px 30px;
border-radius: 10px;
background: linear-gradient(45deg, #ffffff 0%, #f8f9fa 100%);
border: 2px solid #e9ecef;
color: #333;
font-size: 15px;
font-weight: 600;
text-decoration: none;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.google-login-btn:hover {
background: linear-gradient(45deg, #f8f9fa 0%, #e9ecef 100%);
border-color: var(--color-1);
transform: translateY(-2px);
color: #333;
text-decoration: none;
box-shadow: 0 4px 15px rgba(66, 133, 244, 0.2);
}
.google-login-btn:active {
transform: translateY(0);
}
.google-login-btn img {
width: 20px;
height: 20px;
margin-right: 12px;
transition: transform 0.3s ease;
}
.google-login-btn:hover img {
transform: scale(1.1);
}
.eBtn { .eBtn {
padding: 12px 30px; padding: 12px 30px;
border-radius: 10px; border-radius: 10px;
@ -362,10 +438,22 @@ img {
.gradient { .gradient {
background: linear-gradient(45deg, rgba(2, 25, 110, 1) 0%, rgba(2, 25, 110, 1) 13%, rgba(217, 217, 217, 1) 65%, rgba(255, 255, 255, 1) 98%); background: linear-gradient(45deg, rgba(2, 25, 110, 1) 0%, rgba(2, 25, 110, 1) 13%, rgba(217, 217, 217, 1) 65%, rgba(255, 255, 255, 1) 98%);
transition: 0.5s; transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
background-size: 200% auto; background-size: 200% auto;
} }
.eBtn:hover {
background-position: right center;
border-color: #0330c4 !important;
transform: translateY(-1px);
box-shadow: 0 6px 20px rgba(2, 25, 110, 0.25);
}
.eBtn:active {
transform: translateY(0);
transition: all 0.1s ease;
}
.shadow-none { .shadow-none {
box-shadow: none !important; box-shadow: none !important;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -17,7 +17,7 @@
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-8">
<div class="ol-card p-4"> <div class="ol-card p-4">
<h3 class="title text-14px mb-3">{{ get_phrase('Configure ZOOM server-to-server-oauth credentials') }}</h3> <h3 class="title text-14px mb-3">{{ get_phrase('Configure ZOOM server-to-server-oauth credentials') }}</h3>
<div class="ol-card-body"> <div class="ol-card-body">

View File

@ -32,7 +32,7 @@
<input type="hidden" name="type" value="watermark"> <input type="hidden" name="type" value="watermark">
<div class="row"> <div class="row">
<div class="col-md-7 col-xl-8 col-xxl-7"> <div class="col-md-8 col-xl-8 col-xxl-7">
<div class="ol-card p-4"> <div class="ol-card p-4">
<div class="ol-card-body"> <div class="ol-card-body">
<div class="mb-3"> <div class="mb-3">

View File

@ -16,12 +16,11 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-xl-7"> <div class="col-md-8">
<div class="ol-card p-4"> <div class="ol-card p-4">
<h3 class="title text-14px mb-3">{{ get_phrase('System Settings') }}</h3> <h3 class="title text-14px mb-3">{{ get_phrase('System Settings') }}</h3>
<div class="ol-card-body"> <div class="ol-card-body">
<div class="col-lg-12"> <div class="col-lg-12">
<form class="required-form" action="{{ route('admin.system.settings.update') }}" method="post" enctype="multipart/form-data"> <form class="required-form" action="{{ route('admin.system.settings.update') }}" method="post" enctype="multipart/form-data">
@csrf @csrf
<div class="fpb-7 mb-3"> <div class="fpb-7 mb-3">
@ -64,6 +63,11 @@
<textarea name="address" id = "address" class="form-control ol-form-control" rows="5">{{ get_settings('address') }}</textarea> <textarea name="address" id = "address" class="form-control ol-form-control" rows="5">{{ get_settings('address') }}</textarea>
</div> </div>
<div class="fpb-7 mb-3">
<label class="form-label ol-form-label" for="address">{{ get_phrase('Link Google Maps') }}</label>
<textarea name="address" id = "address" class="form-control ol-form-control" rows="1">{{ get_settings('link_gmaps') }}</textarea>
</div>
<div class="fpb-7 mb-3"> <div class="fpb-7 mb-3">
<label class="form-label ol-form-label" for="phone">{{ get_phrase('Phone') }}</label> <label class="form-label ol-form-label" for="phone">{{ get_phrase('Phone') }}</label>
<input type="text" name = "phone" id = "phone" class="form-control ol-form-control" value="{{ get_settings('phone') }}"> <input type="text" name = "phone" id = "phone" class="form-control ol-form-control" value="{{ get_settings('phone') }}">
@ -97,7 +101,6 @@
</select> </select>
</div> </div>
<div class="fpb-7 mb-3 "> <div class="fpb-7 mb-3 ">
<label class="form-label ol-form-label" for="course_selling_tax">{{ get_phrase('Course selling tax') }} (%) <label class="form-label ol-form-label" for="course_selling_tax">{{ get_phrase('Course selling tax') }} (%)
<span>*</span></label> <span>*</span></label>
@ -118,6 +121,14 @@
</select> </select>
</div> </div>
<div class="fpb-7 mb-3">
<label class="form-label ol-form-label" for="google_login">{{ get_phrase('Login with Google') }}</label>
<select class="form-control ol-form-control ol-select2" data-toggle="select2" name="google_login" id="google_login">
<option value="0" @if (get_settings('google_login') != 1) selected @endif>{{ get_phrase('Disabled') }}</option>
<option value="1" @if (get_settings('google_login') == 1) selected @endif>{{ get_phrase('Enabled') }}</option>
</select>
</div>
<div class="fpb-7 mb-3"> <div class="fpb-7 mb-3">
<label class="form-label ol-form-label" for="device_limitation">{{ get_phrase('Device limitation') }}</label> <label class="form-label ol-form-label" for="device_limitation">{{ get_phrase('Device limitation') }}</label>
<input type="number" name="device_limitation" id="device_limitation" class="form-control ol-form-control" value="{{ get_settings('device_limitation') }}" required> <input type="number" name="device_limitation" id="device_limitation" class="form-control ol-form-control" value="{{ get_settings('device_limitation') }}" required>
@ -145,31 +156,10 @@
<button type="submit" class="btn ol-btn-primary" onclick="checkRequiredFields()">{{ get_phrase('Save Changes') }}</button> <button type="submit" class="btn ol-btn-primary" onclick="checkRequiredFields()">{{ get_phrase('Save Changes') }}</button>
</form> </form>
</div> </div>
</div> <!-- end card body--> </div> <!-- end card body-->
</div> <!-- end card --> </div> <!-- end card -->
</div><!-- end col--> </div><!-- end col-->
<div class="col-xl-5">
<div class="ol-card p-4">
<h3 class="title text-14px mb-3">{{ get_phrase('Update Product') }}</h3>
<div class="ol-card-body">
<div class="col-lg-12">
<form action="{{ route('admin.product.update') }}" method="post" enctype="multipart/form-data">
@csrf
<div class="fpb-7 mb-3">
<label class="form-label ol-form-label" class="">{{ get_phrase('File') }}</label>
<input type="file" class="form-control ol-form-control" id="file_name" name="file" required onchange="changeTitleOfImageUploader(this)">
</div>
<button type="submit" class="btn ol-btn-primary">{{ get_phrase('Update') }}</button>
</form>
</div>
</div> <!-- end card body-->
</div>
</div>
</div> </div>
@endsection @endsection
@push('js')@endpush @push('js')@endpush

View File

@ -50,9 +50,9 @@
<div class="form-group mb-25 d-flex justify-content-between align-items-center remember-me"> <div class="form-group mb-25 d-flex justify-content-between align-items-center remember-me">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="flexCheckChecked" {{ old('remember') ? 'checked' : '' }}> <input class="form-check-input" type="checkbox" name="remember" id="flexCheckChecked" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="flexCheckChecked">{{ get_phrase('Remember Me') }}</label> <label class="form-check-label hover-color-1" for="flexCheckChecked">{{ get_phrase('Remember Me') }}</label>
</div> </div>
<a href="{{route('password.request')}}">{{ get_phrase('Forget Password?') }}</a> <a class="hover-color-2" href="{{route('password.request')}}">{{ get_phrase('Forget Password?') }}</a>
</div> </div>
@if(get_frontend_settings('recaptcha_status')) @if(get_frontend_settings('recaptcha_status'))
@ -61,8 +61,21 @@
<button type="submit" class="eBtn gradient w-100">{{ get_phrase('Login') }}</button> <button type="submit" class="eBtn gradient w-100">{{ get_phrase('Login') }}</button>
@endif @endif
@if(get_settings('google_login'))
{{-- Or Divider --}}
<div class="divider mt-4 mb-4">
<span>{{ get_phrase('Or') }}</span>
</div>
{{-- Google Login Button --}}
<a href="javascript:void(0)" onclick="error('{{ get_phrase("Feature still in development 🚧") }}')" class="google-login-btn w-100">
<img src="{{ asset('assets/frontend/default/image/Google.png') }}" alt="Google Logo">
{{ get_phrase('Login with Google') }}
</a>
@endif
<p class="mt-20">{{ get_phrase('Not have an account yet?') }} <p class="mt-20">{{ get_phrase('Not have an account yet?') }}
<a href="{{ route('register.form') }}">{{ get_phrase('Create Account') }}</a> <a class="hover-color-1" href="{{ route('register.form') }}">{{ get_phrase('Create Account') }}</a>
</p> </p>
</form> </form>
</div> </div>

View File

@ -54,7 +54,7 @@
@if (get_settings('allow_instructor')) @if (get_settings('allow_instructor'))
<div class="form-group mb-5"> <div class="form-group mb-5">
<input id="instructor" type="checkbox" name="instructor" value="1" {{ old('instructor') ? 'checked' : '' }}> <input id="instructor" type="checkbox" name="instructor" value="1" {{ old('instructor') ? 'checked' : '' }}>
<label for="instructor">{{ get_phrase('Apply to Become an instructor') }}</label> <label class="hover-color-1" for="instructor">{{ get_phrase('Apply to Become an instructor') }}</label>
</div> </div>
@ -97,8 +97,20 @@
<button type="submit" class="eBtn gradient w-100">{{ get_phrase('Sign Up') }}</button> <button type="submit" class="eBtn gradient w-100">{{ get_phrase('Sign Up') }}</button>
@endif @endif
@if(get_settings('google_login'))
{{-- Or Divider --}}
<div class="divider mt-4 mb-4">
<span>{{ get_phrase('Or') }}</span>
</div>
<p class="mt-20">{{ get_phrase('Already have account?') }} <a href="{{ route('login') }}">{{ get_phrase('Sign in') }}</a></p> {{-- Google Login Button --}}
<a href="javascript:void(0)" onclick="error('{{ get_phrase("Feature still in development 🚧") }}')" class="google-login-btn w-100">
<img src="{{ asset('assets/frontend/default/image/Google.png') }}" alt="Google Logo">
{{ get_phrase('Sign Up with Google') }}
</a>
@endif
<p class="mt-20">{{ get_phrase('Already have account?') }} <a class="hover-color-1" href="{{ route('login') }}">{{ get_phrase('Sign in') }}</a></p>
</form> </form>
</div> </div>
</div> </div>

View File

@ -77,8 +77,6 @@
<div class="entry-details"> <div class="entry-details">
<div class="entry-title"> <div class="entry-title">
<h3 class="ellipsis-line-2">{{ ellipsis(ucfirst($row->title), 160) }}</h3> <h3 class="ellipsis-line-2">{{ ellipsis(ucfirst($row->title), 160) }}</h3>
</div> </div>
<ul> <ul>
<li> <li>

View File

@ -15,7 +15,7 @@
<p class="builder-editable" builder-identity="5">{{ get_phrase('We invites learners to explore courses designed by industry experts, offering cutting-edge content for skill development.')}}</p> <p class="builder-editable" builder-identity="5">{{ get_phrase('We invites learners to explore courses designed by industry experts, offering cutting-edge content for skill development.')}}</p>
<div class="banner-btn"> <div class="banner-btn">
<a href="{{ route('courses') }}" class="eBtn gradient builder-editable" builder-identity="6">{{ get_phrase('Get Started') }}</a> <a href="{{ route('courses') }}" class="eBtn gradient builder-editable" builder-identity="6">{{ get_phrase('Get Started') }}</a>
<a data-bs-toggle="modal" data-bs-target="#promoVideo" href="#" class="eBtn learn-btn"><i class="fa-solid fa-play"></i>{{ get_phrase('Learn More') }}</a> <a data-bs-toggle="modal" data-bs-target="#promoVideo" href="#" class="learn-btn"><i class="fa-solid fa-play"></i>{{ get_phrase('Learn More') }}</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -40,7 +40,7 @@
</div> </div>
</div> </div>
<div class="btn-wrap"> <div class="btn-wrap">
<a href="javascript: void(0);" class="eBtn learn-btn"> <a href="javascript: void(0);" class="earn-btn">
{{ count_student_by_instructor($instructor_details->id) }} {{ count_student_by_instructor($instructor_details->id) }}
</a> </a>
<a href="javascript: void(0);" class="eBtn gradient"> <a href="javascript: void(0);" class="eBtn gradient">