From ef1aa4b9c20e41c3908ae3969eca73c180cdae1f Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Wed, 17 Jul 2024 03:27:03 +0300 Subject: [PATCH] if server setting premoderation = true, or user don't has direct upload, send photo to moderation --- app/Controllers/Api/Images/Upload.php | 12 +++++++++++- views/pages/Profile/LK/History.php | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index c259bae..08fd516 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -17,7 +17,17 @@ class Upload public static function create($postbody, $content, $exif) { - DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :place, :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())); + $user = new \App\Models\User(Auth::userid()); + if (NGALLERY['root']['photo']['upload']['premoderation'] === true) { + if ($user->content('premoderation') === true) { + $moderated = 1; + } else { + $moderated = 0; + } + } else { + $moderated = 1; + } + DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, :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)); echo json_encode( array( 'id' => DB::query('SELECT id FROM photos ORDER BY id DESC LIMIT 1')[0]['id'], diff --git a/views/pages/Profile/LK/History.php b/views/pages/Profile/LK/History.php index 85ec966..6d89efb 100644 --- a/views/pages/Profile/LK/History.php +++ b/views/pages/Profile/LK/History.php @@ -47,8 +47,13 @@ use \App\Models\User; Auth::userid())); foreach ($photos as $p) { + if ($p['moderated'] === 0) { + $color = 's0'; + } else { + $color = 's12'; + } $author = new User($p['user_id']); - echo ' + echo '