From 1c2b512f55249f8a07459551955a81727283131a Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Sat, 20 Jul 2024 23:40:47 +0300 Subject: [PATCH] Update Upload.php --- app/Controllers/Api/Images/Upload.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index 54866b6..97a4c47 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -28,6 +28,12 @@ class Upload $moderated = 1; } DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, 0, :content)', array(':postbody' => $postbody, ':userid' => Auth::userid(), ':time' => mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']), ':content' => $content, ':photourl' => self::$photourl, ':exif' => $exif, ':place' => $_POST['place'], ':timeup'=>time(), ':moderated'=>$moderated)); + if ($moderated === 1) { + $followers = DB::query('SELECT * FROM followers WHERE user_id=:uid', array(':uid'=>Auth::userid())); + foreach ($followers as $f) { + DB::query('INSERT INTO followers_notifications VALUES (\'0\', :uid, :fid, :pid, 0)', array(':uid'=>Auth::userid(), ':fid'=>$f['follower_id'], ':pid'=>DB::query('SELECT * FROM photos ORDER BY id DESC LIMIT 1')[0]['id'])); + } + } echo json_encode( array( 'id' => DB::query('SELECT id FROM photos ORDER BY id DESC LIMIT 1')[0]['id'],