From 37fd33a322bf49fc2a646569cea4d3f85ba9e39f Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:16:04 +0200 Subject: [PATCH] Unique Image String Attached to Uploaded Images The system now assigns a unique string to uploaded images, ensuring renewed cached images when new ones are uploaded. https://github.com/LinkStackOrg/LinkStack/issues/480 --- app/Http/Controllers/AdminController.php | 8 +++--- app/Http/Controllers/UserController.php | 35 +++--------------------- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 6254c70..0629c48 100755 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -274,7 +274,7 @@ public function SendTestMail(Request $request) User::where('id', $id)->update(['name' => $name, 'email' => $email, 'password' => $password, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role]); } if (!empty($profilePhoto)) { - $profilePhoto->move(base_path('assets/img'), $id . ".png"); + $profilePhoto->move(base_path('assets/img'), $id . '_' . time() . ".png"); } if (!empty($customBackground)) { $directory = base_path('assets/img/background-img/'); @@ -286,7 +286,7 @@ public function SendTestMail(Request $request) }} if(file_exists(base_path('assets/img/background-img/').$pathinfo)){File::delete(base_path('assets/img/background-img/').$pathinfo);} - $customBackground->move(base_path('assets/img/background-img/'), $id.".".$request->file('background')->extension()); + $customBackground->move(base_path('assets/img/background-img/'), $id . '_' . time() . "." . $request->file('background')->extension()); } return redirect('admin/users/all'); @@ -339,7 +339,7 @@ public function SendTestMail(Request $request) }} if(file_exists(base_path('/assets/linkstack/images/').$pathinfo)){File::delete(base_path('/assets/linkstack/images/').$pathinfo);} - $logo->move(base_path('/assets/linkstack/images/'), "avatar.".$request->file('image')->extension()); + $logo->move(base_path('/assets/linkstack/images/'), "avatar" . '_' . time() . "." .$request->file('image')->extension()); } if (!empty($icon)) { @@ -353,7 +353,7 @@ public function SendTestMail(Request $request) }} if(file_exists(base_path('/assets/linkstack/images/').$pathinfo)){File::delete(base_path('/assets/linkstack/images/').$pathinfo);} - $icon->move(base_path('/assets/linkstack/images/'), "favicon.".$request->file('icon')->extension()); + $icon->move(base_path('/assets/linkstack/images/'), "favicon" . '_' . time() . "." . $request->file('icon')->extension()); } return back(); } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index f5c15ec..816b26c 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -14,7 +14,6 @@ use Auth; use DB; use ZipArchive; use File; -use DOMDocument; use App\Models\User; use App\Models\Button; @@ -721,34 +720,8 @@ class UserController extends Controller $profilePhoto = $request->file('image'); $pageName = $request->littlelink_name; - $pageDescription = $request->pageDescription; - - // Strip HTML tags except for allowed tags - $pageDescription = strip_tags($pageDescription, '