Forgot half of it.
This commit is contained in:
parent
d103477fe1
commit
163e54def1
55 changed files with 183 additions and 187 deletions
|
@ -25,9 +25,9 @@ if(!empty($_GET['resolve'])) {
|
|||
}
|
||||
|
||||
echo json_encode([
|
||||
'id' => (int)$userInfo->getId(),
|
||||
'id' => (int)$userInfo->id,
|
||||
'name' => $userInfo->name,
|
||||
'avatar' => $msz->urls->format('user-avatar', ['user' => $userInfo->getId(), 'res' => 200]),
|
||||
'avatar' => $msz->urls->format('user-avatar', ['user' => $userInfo->id, 'res' => 200]),
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ while($canResetPassword) {
|
|||
unset($tokenInfo);
|
||||
}
|
||||
|
||||
if(empty($tokenInfo) || !$tokenInfo->isValid || $tokenInfo->userId !== (string)$userInfo->getId()) {
|
||||
if(empty($tokenInfo) || !$tokenInfo->isValid || $tokenInfo->userId !== (string)$userInfo->id) {
|
||||
$notices[] = 'Invalid verification code!';
|
||||
break;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ while($canResetPassword) {
|
|||
}
|
||||
}
|
||||
|
||||
Tools::redirect($msz->urls->format('auth-reset', ['user' => $forgotUser->getId()]));
|
||||
Tools::redirect($msz->urls->format('auth-reset', ['user' => $forgotUser->id]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,10 +95,10 @@ while(!$restricted && !empty($register)) {
|
|||
}
|
||||
|
||||
$msz->usersCtx->users->addRoles($userInfo, $defaultRoleInfo);
|
||||
$msz->config->setString('users.newest', $userInfo->getId());
|
||||
$msz->config->setString('users.newest', $userInfo->id);
|
||||
$msz->perms->precalculatePermissions(
|
||||
$msz->forumCtx->categories,
|
||||
[$userInfo->getId()]
|
||||
[$userInfo->id]
|
||||
);
|
||||
|
||||
Tools::redirect($msz->urls->format('auth-login-welcome', ['username' => $userInfo->name]));
|
||||
|
|
|
@ -94,7 +94,7 @@ switch($commentMode) {
|
|||
400
|
||||
);
|
||||
|
||||
$isOwnComment = $commentInfo->userId === $msz->authInfo->userInfo->getId();
|
||||
$isOwnComment = $commentInfo->userId === $msz->authInfo->userInfo->id;
|
||||
$isModAction = $canDeleteAny && !$isOwnComment;
|
||||
|
||||
if(!$isModAction && !$isOwnComment)
|
||||
|
|
|
@ -15,7 +15,7 @@ try {
|
|||
$perms = $msz->authInfo->getPerms('forum', $categoryInfo);
|
||||
|
||||
$currentUser = $msz->authInfo->userInfo;
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->getId();
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->id;
|
||||
|
||||
if(!$perms->check(Perm::F_CATEGORY_VIEW))
|
||||
Template::throwError(403);
|
||||
|
|
|
@ -7,7 +7,7 @@ use RuntimeException;
|
|||
$mode = (string)filter_input(INPUT_GET, 'm');
|
||||
|
||||
$currentUser = $msz->authInfo->userInfo;
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->getId();
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->id;
|
||||
|
||||
if($mode === 'mark') {
|
||||
if(!$msz->authInfo->isLoggedIn)
|
||||
|
|
|
@ -13,7 +13,7 @@ if(!empty($postMode) && !$msz->authInfo->isLoggedIn)
|
|||
Template::displayInfo('You must be logged in to manage posts.', 401);
|
||||
|
||||
$currentUser = $msz->authInfo->userInfo;
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->getId();
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->id;
|
||||
|
||||
if($postMode !== '' && $msz->usersCtx->hasActiveBan($currentUser))
|
||||
Template::displayInfo('You have been banned, check your profile for more information.', 403);
|
||||
|
@ -43,7 +43,7 @@ switch($postMode) {
|
|||
if(!$perms->check(Perm::F_POST_DELETE_OWN))
|
||||
Template::displayInfo('You are not allowed to delete posts.', 403);
|
||||
|
||||
if($postInfo->userId !== $currentUser->getId())
|
||||
if($postInfo->userId !== $currentUser->id)
|
||||
Template::displayInfo('You can only delete your own posts.', 403);
|
||||
|
||||
// posts may only be deleted within a week of creation, this should be a config value
|
||||
|
|
|
@ -12,7 +12,7 @@ if(!$msz->authInfo->isLoggedIn)
|
|||
Template::throwError(401);
|
||||
|
||||
$currentUser = $msz->authInfo->userInfo;
|
||||
$currentUserId = $currentUser->getId();
|
||||
$currentUserId = $currentUser->id;
|
||||
if($msz->usersCtx->hasActiveBan($currentUser))
|
||||
Template::throwError(403);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ $moderationMode = !empty($_GET['m']) && is_string($_GET['m']) ? (string)$_GET['m
|
|||
$submissionConfirmed = !empty($_GET['confirm']) && is_string($_GET['confirm']) && $_GET['confirm'] === '1';
|
||||
|
||||
$currentUser = $msz->authInfo->userInfo;
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->getId();
|
||||
$currentUserId = $currentUser === null ? '0' : $currentUser->id;
|
||||
|
||||
if($topicId < 1 && $postId > 0) {
|
||||
try {
|
||||
|
@ -123,7 +123,7 @@ if(in_array($moderationMode, $validModerationModes, true)) {
|
|||
if(!$canDeleteOwn)
|
||||
Template::displayInfo("You aren't allowed to delete topics.", 403);
|
||||
|
||||
if($topicInfo->userId !== $currentUser->getId())
|
||||
if($topicInfo->userId !== $currentUser->id)
|
||||
Template::displayInfo('You can only delete your own topics.', 403);
|
||||
|
||||
// topics may only be deleted within a day of creation, this should be a config value
|
||||
|
|
|
@ -64,8 +64,8 @@ while($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
|
|||
severity: $severity, modInfo: $modInfo
|
||||
);
|
||||
|
||||
$msz->createAuditLog('BAN_CREATE', [$banInfo->id, $userInfo->getId()]);
|
||||
Tools::redirect($msz->urls->format('manage-users-bans', ['user' => $userInfo->getId()]));
|
||||
$msz->createAuditLog('BAN_CREATE', [$banInfo->id, $userInfo->id]);
|
||||
Tools::redirect($msz->urls->format('manage-users-bans', ['user' => $userInfo->id]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ while($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
|
|||
|
||||
$msz->createAuditLog(
|
||||
$isNew ? 'MOD_NOTE_CREATE' : 'MOD_NOTE_UPDATE',
|
||||
[$noteInfo->id, $userInfo->getId()]
|
||||
[$noteInfo->id, $userInfo->id]
|
||||
);
|
||||
|
||||
// this is easier
|
||||
|
|
|
@ -37,7 +37,7 @@ try {
|
|||
$currentUserRank = $msz->usersCtx->users->getUserRank($currentUser);
|
||||
$userRank = $msz->usersCtx->users->getUserRank($userInfo);
|
||||
|
||||
$canEdit = $canManageUsers && ($currentUser->super || (string)$currentUser->getId() === $userInfo->getId() || $currentUserRank > $userRank);
|
||||
$canEdit = $canManageUsers && ($currentUser->super || (string)$currentUser->id === $userInfo->id || $currentUserRank > $userRank);
|
||||
$canEditPerms = $canEdit && $canManagePerms;
|
||||
|
||||
$permsInfos = $msz->perms->getPermissionInfo(userInfo: $userInfo, categoryNames: Perm::INFO_FOR_USER);
|
||||
|
@ -54,15 +54,15 @@ if(CSRF::validateRequest() && $canEdit) {
|
|||
$allowToImpersonate = $currentUser->super;
|
||||
|
||||
if(!$allowToImpersonate) {
|
||||
$allowImpersonateUsers = $msz->config->getArray(sprintf('impersonate.allow.u%s', $currentUser->getId()));
|
||||
$allowToImpersonate = in_array($userInfo->getId(), $allowImpersonateUsers, true);
|
||||
$allowImpersonateUsers = $msz->config->getArray(sprintf('impersonate.allow.u%s', $currentUser->id));
|
||||
$allowToImpersonate = in_array($userInfo->id, $allowImpersonateUsers, true);
|
||||
}
|
||||
|
||||
if($allowToImpersonate) {
|
||||
$msz->createAuditLog('USER_IMPERSONATE', [$userInfo->getId(), $userInfo->name]);
|
||||
$msz->createAuditLog('USER_IMPERSONATE', [$userInfo->id, $userInfo->name]);
|
||||
|
||||
$tokenBuilder = $msz->authInfo->tokenInfo->toBuilder();
|
||||
$tokenBuilder->setImpersonatedUserId($userInfo->getId());
|
||||
$tokenBuilder->setImpersonatedUserId($userInfo->id);
|
||||
$tokenInfo = $tokenBuilder->toInfo();
|
||||
|
||||
AuthTokenCookie::apply($tokenPacker->pack($tokenInfo));
|
||||
|
@ -108,7 +108,7 @@ if(CSRF::validateRequest() && $canEdit) {
|
|||
if($roleInfo->default || !($currentUser->super || $userRank > $roleInfo->rank))
|
||||
continue;
|
||||
|
||||
if(!in_array($roleInfo->getId(), $applyRoles))
|
||||
if(!in_array($roleInfo->id, $applyRoles))
|
||||
$removeRoles[] = $roleInfo;
|
||||
}
|
||||
|
||||
|
@ -212,10 +212,10 @@ if(CSRF::validateRequest() && $canEdit) {
|
|||
if($permsNeedRecalc)
|
||||
$msz->perms->precalculatePermissions(
|
||||
$msz->forumCtx->categories,
|
||||
[$userInfo->getId()]
|
||||
[$userInfo->id]
|
||||
);
|
||||
|
||||
Tools::redirect($msz->urls->format('manage-user', ['user' => $userInfo->getId()]));
|
||||
Tools::redirect($msz->urls->format('manage-user', ['user' => $userInfo->id]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ while($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
|
|||
$userInfo, $body, modInfo: $modInfo
|
||||
);
|
||||
|
||||
$msz->createAuditLog('WARN_CREATE', [$warnInfo->id, $userInfo->getId()]);
|
||||
Tools::redirect($msz->urls->format('manage-users-warnings', ['user' => $userInfo->getId()]));
|
||||
$msz->createAuditLog('WARN_CREATE', [$warnInfo->id, $userInfo->id]);
|
||||
Tools::redirect($msz->urls->format('manage-users-warnings', ['user' => $userInfo->id]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ $isEditing = !empty($_GET['edit']) && is_string($_GET['edit']) ? (bool)$_GET['ed
|
|||
|
||||
$viewerInfo = $msz->authInfo->userInfo;
|
||||
$viewingAsGuest = $viewerInfo === null;
|
||||
$viewerId = $viewingAsGuest ? '0' : $viewerInfo->getId();
|
||||
$viewerId = $viewingAsGuest ? '0' : $viewerInfo->id;
|
||||
|
||||
try {
|
||||
$userInfo = $msz->usersCtx->getUserInfo($userId, 'profile');
|
||||
|
@ -66,7 +66,7 @@ $viewerPermsUser = $msz->authInfo->getPerms('user');
|
|||
|
||||
$activeBanInfo = $msz->usersCtx->tryGetActiveBan($userInfo);
|
||||
$isBanned = $activeBanInfo !== null;
|
||||
$viewingOwnProfile = (string)$viewerId === $userInfo->getId();
|
||||
$viewingOwnProfile = (string)$viewerId === $userInfo->id;
|
||||
$canManageWarnings = $viewerPermsUser->check(Perm::U_WARNINGS_MANAGE);
|
||||
$canEdit = !$viewingAsGuest && ((!$isBanned && $viewingOwnProfile) || $viewerInfo->super || (
|
||||
$viewerPermsUser->check(Perm::U_USERS_MANAGE) && ($viewingOwnProfile || $viewerRank > $userRank)
|
||||
|
|
|
@ -69,7 +69,7 @@ if(!empty($searchQuery)) {
|
|||
|
||||
if(empty($searchQueryEvaluated['type']) || str_starts_with($searchQueryEvaluated['type'], 'forum')) {
|
||||
$currentUser = $msz->authInfo->userInfo;
|
||||
$currentUserId = $currentUser === null ? 0 : (int)$currentUser->getId();
|
||||
$currentUserId = $currentUser === null ? 0 : (int)$currentUser->id;
|
||||
|
||||
$forumCategoryIds = XArray::where(
|
||||
$msz->forumCtx->categories->getCategories(hidden: false),
|
||||
|
|
|
@ -35,7 +35,7 @@ if(!$isRestricted && $isVerifiedRequest && !empty($_POST['role'])) {
|
|||
$msz->usersCtx->users->removeRoles($userInfo, $roleInfo);
|
||||
$msz->perms->precalculatePermissions(
|
||||
$msz->forumCtx->categories,
|
||||
[$userInfo->getId()]
|
||||
[$userInfo->id]
|
||||
);
|
||||
} else
|
||||
$errors[] = "You're not allow to leave this role, an administrator has to remove it for you.";
|
||||
|
@ -110,7 +110,7 @@ if($isVerifiedRequest && !empty($_POST['current_password'])) {
|
|||
|
||||
// reload $userInfo object
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST' && $isVerifiedRequest)
|
||||
$userInfo = $msz->usersCtx->users->getUser($userInfo->getId(), 'id');
|
||||
$userInfo = $msz->usersCtx->users->getUser($userInfo->id, 'id');
|
||||
|
||||
$userRoles = iterator_to_array($msz->usersCtx->roles->getRoles(userInfo: $userInfo));
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ $dbConn = $msz->dbConn;
|
|||
function db_to_zip(ZipArchive $archive, UserInfo $userInfo, string $baseName, array $fieldInfos, string $userIdField = 'user_id'): string {
|
||||
global $dbConn;
|
||||
|
||||
$userId = $userInfo->getId();
|
||||
$userId = $userInfo->id;
|
||||
$fields = [];
|
||||
|
||||
foreach($fieldInfos as $key => $fieldInfo) {
|
||||
|
@ -107,7 +107,7 @@ if(isset($_POST['action']) && is_string($_POST['action'])) {
|
|||
$msz->createAuditLog('PERSONAL_DATA_DOWNLOAD');
|
||||
|
||||
$timeStamp = floor(time() / 3600) * 3600;
|
||||
$fileName = sprintf('msz-user-data-%d-%d.zip', $userInfo->getId(), $timeStamp);
|
||||
$fileName = sprintf('msz-user-data-%d-%d.zip', $userInfo->id, $timeStamp);
|
||||
$filePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;
|
||||
$archive = new ZipArchive;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ while($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
|
|||
$sessionInfo = $msz->authCtx->sessions->getSession(sessionId: $sessionId);
|
||||
} catch(RuntimeException $ex) {}
|
||||
|
||||
if(empty($sessionInfo) || $sessionInfo->userId !== $currentUser->getId()) {
|
||||
if(empty($sessionInfo) || $sessionInfo->userId !== $currentUser->id) {
|
||||
$errors[] = "That session doesn't exist.";
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue