From e6b5e164565c52ef220441ad98e3eaa5188d6780 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 27 Dec 2022 17:47:18 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Fixes=20inappropriate=20=C2=ABpermission=20?= =?UTF-8?q?denied=C2=BB=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/gallery.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/www/gallery.php b/www/gallery.php index 886a1b5..f24c2fd 100644 --- a/www/gallery.php +++ b/www/gallery.php @@ -66,7 +66,7 @@ $doAction = (string)$_GET['do']; /** Das Benoten (und mypic markieren) können nebst Schönen auch die registrierten User, deshalb müssen wirs vorziehen... */ - if ($user->is_loggedin() && isset($_POST['picID']) && !empty($_POST['picID']) && $_POST['picID'] > 0) + if ($user->is_loggedin() && ($doAction === 'benoten' || $doAction === 'mypic') && isset($_POST['picID']) && !empty($_POST['picID']) && $_POST['picID'] > 0) { switch ($doAction) { @@ -83,12 +83,12 @@ } break; } - } else { + } elseif (!$user->is_loggedin() && !empty($doAction)) { $smarty->assign('error', ['type' => 'warn', 'dismissable' => 'false', 'title' => t('permissions-insufficient', 'gallery', [$doAction])]); } /** Ab hier kommt nur noch Zeugs dass Member & Schöne machen dürfen */ - if ($user->typ >= USER_MEMBER) + if ($user->typ >= USER_MEMBER && (!empty($doAction) && $doAction != 'benoten' && $doAction != 'mypic')) { switch ($doAction) { @@ -128,9 +128,8 @@ /*case 'markieren': doMark($getPicId); break;*/ - } - } else { + } elseif ($user->typ < USER_MEMBER && !empty($doAction)) { $smarty->assign('error', ['type' => 'warn', 'dismissable' => 'false', 'title' => t('permissions-insufficient', 'gallery', [$doAction])]); } From f1768c5b5edc4804680d280538e24d487e7547c1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 27 Dec 2022 21:15:00 +0100 Subject: [PATCH 2/3] Fixes some Errors in PHP, JS Console and hardens AJAX --- www/includes/gallery.inc.php | 6 +++--- www/js/ajax/get-onlineuser.php | 21 +++++++++++++++------ www/js/ajax/get-unreadcomments.php | 17 ++++++++++++----- www/js/mobilez/browsernotifications.js | 8 ++++---- www/js/zorg.js | 2 ++ 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/www/includes/gallery.inc.php b/www/includes/gallery.inc.php index a40a7ec..557c4a4 100644 --- a/www/includes/gallery.inc.php +++ b/www/includes/gallery.inc.php @@ -362,7 +362,7 @@ function pic ($id) /** Bild Zensur-Info */ if ($cur['zensur'] === '1') echo '🫥'; /** Bild Datum (Desktop Viewports) */ - if (!$user->from_mobile && is_file($pic_filepath) !== false) + if ((!isset($user->from_mobile) || false === $user->from_mobile) && is_file($pic_filepath) !== false) { /** APOD Special: use pic_added from database, instead of filemtime */ if ($cur['album'] == APOD_GALLERY_ID && !empty($cur['timestamp'])) { @@ -434,7 +434,7 @@ function pic ($id) echo ''; /** Bild Datum (Mobile Viewports) */ - if ($user->from_mobile != false && is_file($pic_filepath) !== false) + if (isset($user->from_mobile) && $user->from_mobile != false && is_file($pic_filepath) !== false) { echo ''; /** APOD Special: use pic_added from database, instead of filemtime */ @@ -507,7 +507,7 @@ function pic ($id) /** * Mobile Touch Swipe - next/prev Pic */ - if ($user->from_mobile != false) + if (isset($user->from_mobile) && $user->from_mobile != false) { echo '