From f238bf776e865b684354e802dea121efec1bfc22 Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Sat, 20 Jul 2024 23:55:53 +0300 Subject: [PATCH] Update SetVisibility.php --- app/Controllers/Api/Admin/Images/SetVisibility.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Controllers/Api/Admin/Images/SetVisibility.php b/app/Controllers/Api/Admin/Images/SetVisibility.php index 30cc3e3..f378130 100644 --- a/app/Controllers/Api/Admin/Images/SetVisibility.php +++ b/app/Controllers/Api/Admin/Images/SetVisibility.php @@ -13,6 +13,13 @@ class SetVisibility public function __construct() { DB::query('UPDATE photos SET moderated=:mod, timeupload=:time WHERE id=:id', array(':id'=>$_GET['id'], ':mod'=>$_GET['mod'], ':time'=>time())); + $uid = DB::query('SELECT user_id FROM photos WHERE id=:id', array(':id'=>$_GET['id']))[0]['user_id']; + if ($_GET['mod'] === 1) { + $followers = DB::query('SELECT * FROM followers WHERE user_id=:uid', array(':uid'=>$uid)); + foreach ($followers as $f) { + DB::query('INSERT INTO followers_notifications VALUES (\'0\', :uid, :fid, :pid, 0)', array(':uid'=>$uid, ':fid'=>$f['follower_id'], ':pid'=>$_GET['id'])); + } + } header('Location: ' . $_SERVER['HTTP_REFERER']); } } \ No newline at end of file