mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-24 05:34:43 +00:00
Merge remote-tracking branch 'origin/master' into email-verification
This commit is contained in:
@@ -12,9 +12,10 @@ class UpdateUserPassword implements UpdatesUserPasswords
|
||||
/**
|
||||
* Validate and update the user's password.
|
||||
*
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @return void
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function update($user, array $input)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Faker;
|
||||
use App\Models\File;
|
||||
use App\Models\User;
|
||||
use App\Models\Share;
|
||||
@@ -11,9 +10,12 @@ use Illuminate\Support\Str;
|
||||
use App\Services\SetupService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
|
||||
class SetupDevEnvironment extends Command
|
||||
{
|
||||
use WithFaker;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
@@ -34,12 +36,13 @@ class SetupDevEnvironment extends Command
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->faker = Faker\Factory::create();
|
||||
$this->setUpFaker();
|
||||
$this->setup = resolve(SetupService::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
* return @void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
@@ -608,7 +611,7 @@ class SetupDevEnvironment extends Command
|
||||
'whaaaaat.jpg',
|
||||
'You Are My Sunshine.jpg',
|
||||
])
|
||||
->each(function ($file) use ($user, $apartments) {
|
||||
->each(function ($file) use ($user) {
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
|
||||
@@ -179,7 +179,7 @@ class SetupProdEnvironment extends Command
|
||||
{
|
||||
$user = User::forceCreate([
|
||||
'role' => 'admin',
|
||||
'email' => 'admin@vuefilemanager.com',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
'password' => bcrypt('vuefilemanager'),
|
||||
]);
|
||||
|
||||
@@ -191,7 +191,7 @@ class SetupProdEnvironment extends Command
|
||||
]);
|
||||
|
||||
// Show user credentials
|
||||
$this->info('Default admin account created. Email: admin@vuefilemanager.com and Password: vuefilemanager');
|
||||
$this->info('Default admin account created. Email: howdy@hi5ve.digital and Password: vuefilemanager');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use DB;
|
||||
use App\Models\User;
|
||||
use ByteUnits\Metric;
|
||||
use App\Services\StripeService;
|
||||
@@ -11,9 +10,8 @@ use App\Http\Resources\UsersCollection;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* @param StripeService $stripe
|
||||
*/
|
||||
private StripeService $stripe;
|
||||
|
||||
public function __construct(StripeService $stripe)
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
@@ -32,7 +30,7 @@ class DashboardController extends Controller
|
||||
|
||||
// Get total storage usage
|
||||
$storage_usage = Metric::bytes(
|
||||
DB::table('files')->sum('filesize')
|
||||
\DB::table('files')->sum('filesize')
|
||||
)->format();
|
||||
|
||||
return [
|
||||
|
||||
@@ -9,9 +9,8 @@ use App\Http\Resources\InvoiceAdminCollection;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* @param StripeService $stripe
|
||||
*/
|
||||
private StripeService $stripe;
|
||||
|
||||
public function __construct(StripeService $stripe)
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
|
||||
@@ -12,6 +12,8 @@ use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
|
||||
class PagesController extends Controller
|
||||
{
|
||||
private $demo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->demo = resolve(DemoService::class);
|
||||
|
||||
@@ -18,12 +18,13 @@ use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
|
||||
class PlanController extends Controller
|
||||
{
|
||||
/**
|
||||
* @param StripeService $stripe
|
||||
*/
|
||||
public function __construct(StripeService $stripe)
|
||||
private StripeService $stripe;
|
||||
|
||||
private DemoService $demo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
$this->stripe = resolve(StripeService::class);
|
||||
$this->demo = resolve(DemoService::class);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,8 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class SettingController extends Controller
|
||||
{
|
||||
/**
|
||||
* SettingController constructor.
|
||||
*/
|
||||
private $demo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->demo = resolve(DemoService::class);
|
||||
|
||||
@@ -23,6 +23,8 @@ use App\Http\Requests\Admin\ChangeStorageCapacityRequest;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
private StripeService $stripe;
|
||||
|
||||
public function __construct(StripeService $stripe)
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
|
||||
@@ -25,11 +25,13 @@ class AppFunctionsController extends Controller
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $blacklist = [
|
||||
private array $blacklist = [
|
||||
'purchase_code',
|
||||
'license',
|
||||
];
|
||||
|
||||
private StripeService $stripe;
|
||||
|
||||
public function __construct(StripeService $stripe)
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
|
||||
@@ -149,6 +149,7 @@ class EditItemsController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
* @return string
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function zip_multiple_files(Request $request)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,10 @@ use App\Http\Requests\Payments\RegisterNewPaymentMethodRequest;
|
||||
|
||||
class PaymentMethodsController extends Controller
|
||||
{
|
||||
private StripeService $stripe;
|
||||
|
||||
private DemoService $demo;
|
||||
|
||||
public function __construct(StripeService $stripe)
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
|
||||
+21
-30
@@ -277,7 +277,7 @@ function is_visitor($shared)
|
||||
*
|
||||
* @param $request
|
||||
* @param $name
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
function store_avatar($request, $name)
|
||||
{
|
||||
@@ -290,14 +290,20 @@ function store_avatar($request, $name)
|
||||
// Store avatar
|
||||
$image_path = Str::random(16) . '-' . $image->getClientOriginalName();
|
||||
|
||||
// Create intervention image
|
||||
$img = Image::make($image->getRealPath());
|
||||
if (in_array($image->getClientMimeType(), ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'])) {
|
||||
// Create intervention image
|
||||
$img = Image::make($image->getRealPath());
|
||||
|
||||
// Generate thumbnail
|
||||
$img->fit('150', '150')->stream();
|
||||
// Generate thumbnail
|
||||
$img->fit('150', '150')->stream();
|
||||
|
||||
// Store thumbnail to disk
|
||||
Storage::put("avatars/$image_path", $img);
|
||||
// Store thumbnail to disk
|
||||
Storage::put("avatars/$image_path", $img);
|
||||
}
|
||||
|
||||
if ($image->getClientMimeType() === 'image/svg+xml') {
|
||||
Storage::putFileAs('avatars', $image, $image_path);
|
||||
}
|
||||
|
||||
// Return path to image
|
||||
return "avatars/$image_path";
|
||||
@@ -308,7 +314,7 @@ function store_avatar($request, $name)
|
||||
*
|
||||
* @param $request
|
||||
* @param $name
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
function store_system_image($request, $name)
|
||||
{
|
||||
@@ -505,7 +511,7 @@ function format_date($date, $format = '%d. %B. %Y, %H:%M')
|
||||
/**
|
||||
* Get file type from mimetype
|
||||
*
|
||||
* @param $file
|
||||
* @param $file_mimetype
|
||||
* @return string
|
||||
*/
|
||||
function get_file_type($file_mimetype)
|
||||
@@ -513,25 +519,11 @@ function get_file_type($file_mimetype)
|
||||
// Get mimetype from file
|
||||
$mimetype = explode('/', $file_mimetype);
|
||||
|
||||
switch ($mimetype[0]) {
|
||||
case 'image':
|
||||
return 'image';
|
||||
|
||||
break;
|
||||
|
||||
case 'video':
|
||||
return 'video';
|
||||
|
||||
break;
|
||||
|
||||
case 'audio':
|
||||
return 'audio';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return 'file';
|
||||
if (in_array($mimetype[0], ['image', 'video', 'audio'])) {
|
||||
return $mimetype[0];
|
||||
}
|
||||
|
||||
return 'file';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -585,7 +577,7 @@ function get_pretty_name($basename, $name, $mimetype)
|
||||
* Get exif data from jpeg image
|
||||
*
|
||||
* @param $file
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
function get_image_meta_data($file)
|
||||
{
|
||||
@@ -853,10 +845,9 @@ function set_time_by_user_timezone($time)
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user) {
|
||||
// Get the value of timezone if user have some
|
||||
$time_zone = intval($user->settings->timezone * 60 ?? null);
|
||||
|
||||
return Carbon::parse($time)->addMinutes($time_zone ?? null);
|
||||
return Carbon::parse($time)->addMinutes($time_zone ?? 0);
|
||||
}
|
||||
|
||||
return Carbon::parse($time);
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ class File extends Model
|
||||
/**
|
||||
* Form\a\t created at date reformat
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDeletedAtAttribute()
|
||||
{
|
||||
@@ -98,7 +98,7 @@ class File extends Model
|
||||
/**
|
||||
* Format thumbnail url
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getThumbnailAttribute()
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ class Folder extends Model
|
||||
/**
|
||||
* Format created at date reformat
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDeletedAtAttribute()
|
||||
{
|
||||
|
||||
@@ -6,6 +6,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @method static whereNotNull(string $string)
|
||||
*/
|
||||
class Share extends Model
|
||||
{
|
||||
use Notifiable, HasFactory;
|
||||
|
||||
@@ -9,10 +9,12 @@ class ResetPassword extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
private $token;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
* @param $token
|
||||
*/
|
||||
public function __construct($token)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ use App\Models\File as UserFile;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Madnest\Madzipper\Facades\Madzipper;
|
||||
use League\Flysystem\FileNotFoundException;
|
||||
use App\Http\Requests\FileFunctions\RenameItemRequest;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
@@ -63,7 +62,8 @@ class FileManagerService
|
||||
$zip_name = Str::random(16) . '-' . Str::slug($requested_folder->name) . '.zip';
|
||||
|
||||
// Create zip
|
||||
$zip = Madzipper::make($disk_local->path("zip/$zip_name"));
|
||||
$zipper = new \Madnest\Madzipper\Madzipper;
|
||||
$zip = $zipper->make($disk_local->path("zip/$zip_name"));
|
||||
|
||||
// Add files to zip
|
||||
foreach ($files as $file) {
|
||||
@@ -77,7 +77,7 @@ class FileManagerService
|
||||
}
|
||||
|
||||
// Close zip
|
||||
$zip->close();
|
||||
//$zip->close();
|
||||
|
||||
// Delete temporary files
|
||||
if (! is_storage_driver('local')) {
|
||||
@@ -122,7 +122,8 @@ class FileManagerService
|
||||
$zip_name = Str::random(16) . '.zip';
|
||||
|
||||
// Create zip
|
||||
$zip = Madzipper::make($disk_local->path("zip/$zip_name"));
|
||||
$zipper = new \Madnest\Madzipper\Madzipper;
|
||||
$zip = $zipper->make($disk_local->path("zip/$zip_name"));
|
||||
|
||||
// Add files to zip
|
||||
$files->each(function ($file) use ($zip, $disk_local) {
|
||||
@@ -134,7 +135,7 @@ class FileManagerService
|
||||
});
|
||||
|
||||
// Close zip
|
||||
$zip->close();
|
||||
//$zip->close();
|
||||
|
||||
// Delete temporary files
|
||||
if (! is_storage_driver('local')) {
|
||||
|
||||
@@ -125,7 +125,7 @@ class HelperService
|
||||
*/
|
||||
public function move_file_to_external_storage($file, $user_id): void
|
||||
{
|
||||
$disk_local = Storage::disk('local');
|
||||
$disk_local = \Storage::disk('local');
|
||||
|
||||
// Get file size
|
||||
$filesize = $disk_local->size("files/$user_id/$file");
|
||||
@@ -145,7 +145,7 @@ class HelperService
|
||||
// TODO: replace local files with temp folder
|
||||
$uploader = new MultipartUploader($client, config('filesystems.disks.local.root') . "/files/$user_id/$file", [
|
||||
'bucket' => $adapter->getBucket(),
|
||||
'key' => "/files/$user_id/$file",
|
||||
'key' => "files/$user_id/$file",
|
||||
]);
|
||||
|
||||
try {
|
||||
@@ -156,7 +156,7 @@ class HelperService
|
||||
Log::error($e->getMessage());
|
||||
|
||||
// Delete file after error
|
||||
$disk_local->delete("/files/$user_id/$file");
|
||||
$disk_local->delete("files/$user_id/$file");
|
||||
|
||||
throw new HttpException(409, $e->getMessage());
|
||||
}
|
||||
@@ -167,7 +167,7 @@ class HelperService
|
||||
}
|
||||
|
||||
// Delete file after upload
|
||||
$disk_local->delete("/files/$user_id/$file");
|
||||
$disk_local->delete("files/$user_id/$file");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ class SchedulerService
|
||||
->get()
|
||||
->each(function ($zip) {
|
||||
// Delete zip file
|
||||
\Storage::disk('local')->delete("zip/$zip->basename");
|
||||
Storage::disk('local')->delete("zip/$zip->basename");
|
||||
|
||||
// Delete zip record
|
||||
$zip->delete();
|
||||
|
||||
@@ -13,6 +13,8 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class StripeService
|
||||
{
|
||||
private \Cartalyst\Stripe\Stripe $stripe;
|
||||
|
||||
/**
|
||||
* Stripe Service constructor.
|
||||
*/
|
||||
@@ -115,9 +117,8 @@ class StripeService
|
||||
*
|
||||
* @param $request
|
||||
* @param $user
|
||||
* @return mixed
|
||||
*/
|
||||
public function registerNewPaymentMethod($request, $user)
|
||||
public function registerNewPaymentMethod($request, $user): void
|
||||
{
|
||||
// Clear cached payment methods
|
||||
cache_forget_many([
|
||||
@@ -139,10 +140,8 @@ class StripeService
|
||||
*
|
||||
* @param $request
|
||||
* @param $user
|
||||
* @param $paymentMethod
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createOrReplaceSubscription($request, $user)
|
||||
public function createOrReplaceSubscription($request, $user): void
|
||||
{
|
||||
try {
|
||||
// Get payment method
|
||||
@@ -198,7 +197,9 @@ class StripeService
|
||||
public function getPlans()
|
||||
{
|
||||
// Get stripe plans
|
||||
$stripe_plans = $this->stripe->plans()->all();
|
||||
$stripe_plans = $this->stripe->plans()->all([
|
||||
'limit' => 100,
|
||||
]);
|
||||
|
||||
// Plans container
|
||||
$plans = [];
|
||||
@@ -227,7 +228,9 @@ class StripeService
|
||||
public function getActivePlans()
|
||||
{
|
||||
// Get stripe plans
|
||||
$stripe_plans = $this->stripe->plans()->all();
|
||||
$stripe_plans = $this->stripe->plans()->all([
|
||||
'limit' => 100,
|
||||
]);
|
||||
|
||||
// Plans container
|
||||
$plans = [];
|
||||
|
||||
Reference in New Issue
Block a user