$groupToAdd = $_POST['grouptoadd']; //Insert group connection executePreparedSQLQuery($mysqlConn, 'INSERT IGNORE INTO groupconnections (userId, groupId) VALUES (?, ?)', 'ii', [$userId, $groupToAdd]); //Get group name $groupName = getArrayFromSQLQuery($mysqlConn, 'SELECT name FROM groups WHERE groupId = ?', 'i', [$groupToAdd])[0]['name']; //Create notification summary and body $notificationSummary = 'You are now part of "' . $groupName . '".'; $notificationBody = 'You have been added to the group "' . $groupName . '" by an administrator.'; } if (isset($_POST['grouptoremove'])) { $groupToRemove = $_POST['grouptoremove']; //Get group name $groupName = getArrayFromSQLQuery($mysqlConn, 'SELECT name FROM groups WHERE groupId = ?', 'i', [$groupToRemove])[0]['name']; //Remove group connection executePreparedSQLQuery($mysqlConn, 'DELETE FROM groupconnections WHERE userId = ? AND groupId = ?', 'ii', [$userId, $groupToRemove]); //Create notification summary and body $notificationSummary = 'You are no longer part of "' . $groupName . '".'; $notificationBody = 'You have been removed from the group "' . $groupName . '" by an administrator.'; } //Send notification if corresponding checkbox was checked if (isset($_POST['sendnotification']) && $_POST['sendnotification'] === 'yes') { $notificationManager = new notification_manager($mysqlConn); $notificationManager->createUserNotification($userId, $notificationSummary, $notificationBody); } $mysqlConn->close(); unset($_SESSION['admin_userview_token' . $userId]); unset($_SESSION['admin_users_token']); echo 'User group settings set.'; require_once '../../common/ucpfooter.php';
{ return $page == $currentPage ? '<button type="button" class="btn btn-primary">' . $page . '</button>' : '<a href="?page=' . $page . '"><button type="button" class="btn">' . $page . '</button></a>'; } ?> <h1 class="animated bounceInDown text-center">Notifications</h1> <br /> <?php $currentPage = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0 ? $_GET['page'] : 1; //Get current page $notificationsPerPage = getConfigValue('notifications_per_page'); $pagesBehind = getConfigValue('notifications_pages_behind'); $pagesAhead = getConfigValue('notifications_pages_ahead'); $notificationManager = new notification_manager(); $notificationCount = $notificationManager->getNotificationCount(); $notificationsToDisplay = $notificationManager->getNotifications($notificationsPerPage, $notificationsPerPage * ($currentPage - 1)); foreach ($notificationsToDisplay as $notification) { ?> <div class="well clearfix"> <div class="clearfix"> <div class="pull-left"> <h4><strong> <?php if (!$notification->isRead) { echo '<span class="badge">!</span> '; //Display an indicator for unread notifications } if (!empty($notification->url)) {
return $array; } session_start(); $now = time(); if (isset($_SESSION['last_active']) && $now > $_SESSION['last_active'] + 60 * 60) { //If the user has been inactive for 1 hour... //...their session expires session_unset(); session_destroy(); } if (isset($_SESSION['user_id'], $_SESSION['user_token'])) { $mysqlConn = connectToDatabase(); $matchingUsers = getArrayFromSQLQuery($mysqlConn, 'SELECT nick FROM users WHERE userId = ? AND token = ? LIMIT 1', 'ss', [$_SESSION['user_id'], $_SESSION['user_token']]); //Get user nickname if (count($matchingUsers) === 1) { //Get user nickname $_SESSION['user_nick'] = $matchingUsers[0]['nick']; //Get user groups $_SESSION['user_groups'] = getGroupsForUser($mysqlConn, $_SESSION['user_id']); //Get information about unread notifications $notificationManager = new notification_manager($mysqlConn); $unreadNotificationCount = $notificationManager->getUnreadNotificationCount(); $unreadNotificationSummaries = $notificationManager->getUnreadNotificationSummaries(2); } else { session_unset(); session_destroy(); } $mysqlConn->close(); } $_SESSION['last_active'] = $now; //Set last activity time to now
WHERE appGuid = ? AND imageIndex = ?', 'si', [$guid, $i]); //Get screenshot blob name from URL $screenshotToDeleteBlobName = substr($matchingScreenshotsToDelete[0]['url'], strrpos($matchingScreenshotsToDelete[0]['url'], '/') + 1); //Delete screenshot from Azure storage $blobRestProxy->deleteBlob(getConfigValue('azure_container_screenshots'), $screenshotToDeleteBlobName); } } } unset($_SESSION['myapps_token' . $guid]); unset($_SESSION['publish_token' . $guid]); if ($isDeveloper || $updatingApp && $currentPublishState === 1 && !$updating3dsx && !$uploadingAppData) { echo 'Your application has been published.'; } else { //Prepare notification $notificationSummary = '"' . $appName . '" is awaiting approval.'; $notificationBody = $notificationSummary; //Create notification $notificationManager = new notification_manager($mysqlConn); $notificationManager->createGroupNotification('Moderators', $notificationSummary, $notificationBody, '/secure/mod/apps.php'); if (!$updatingApp) { echo 'Your application has been submitted and is now pending approval from our staff.'; } else { echo 'Your update has been submitted and is now pending approval from our staff. The current version is still available.'; } } exit; } catch (Exception $e) { $errorMessage = $e->getMessage(); } } }