-
Notifications
You must be signed in to change notification settings - Fork 8
Plugin blokowanie PW #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Plugin blokowanie PW #171
Conversation
event15
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Na razie przejrzałem sam kod - zaraz sprawdzę działanie.
|
Domerguj tu mastera |
|
Ok, to teraz więcej mogę powiedzieć.
|
|
Cofam - jednak działa. Plugin pozwala na wysyłkę postów na wall -> może warto rozważyć blokadę? :) |
| @@ -0,0 +1,17 @@ | |||
| <?php | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
podałem Ci rozwiązanie - czemu nie chcesz z niego skoryzstać?
Dostałeś rozwiązanie z qa_opt(), które pozwala na weryfikację czy plugin jest w ogóle włączony. Przecież powinna być opcja wygodnego włączenia czy wyłączenia pluginu, bez usuwania go z serwera.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wydaje mi się że nie ma sensu włączania/wyłączania pluginu który służy tylko do blokowania użytkowników co też wyjaśniliśmy na Discordzie.
| } | ||
|
|
||
| private function performFormAction($loggedInId, $profileUserId): void | ||
| private function performFormAction(int $loggedInId, int $profileUserId): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
posprawdzaj - ja wczoraj miałem trochę z tym zabawy - czasami powinienbyć ?int pozwalający na nullowanie argumentu. Dziś już nie pamiętam gdzie dokładnie się pojawiało, ale warto sprawdzić.
| $allowedToSeeButtons = $dbUser['handle'] !== qa_get_logged_in_handle() && strpos(qa_request(), 'user/') !== false && count(qa_request_parts()) === 2; | ||
|
|
||
| if (!empty($dbUser) | ||
| && $dbUser['level'] == QA_USER_LEVEL_BASIC // cannot use `===` - $dbUser['level'] is string, const is int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
można castować zmienne :)
| } | ||
|
|
||
| function qa_user_permit_error($permitoption=null, $limitaction=null, $userlevel=null, $checkblocks=true) | ||
| function qa_user_permit_error(string $permitoption=null, string $limitaction=null, string $userlevel=null, bool $checkblocks=true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
przeszło Ci to? mi wywalało forum jak tak zrobiłem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Działa :v
| } | ||
|
|
||
| public function process_request(string $request): ?array | ||
| public function process_request(): ?array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
czyli nie czujesz potrzeby weryfikacji, czy przychodzi poprawny request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeśli dobrze rozumiem filozofię q2a, linijkę wyżej sprawdzam czy to jest request który mnie interesuje - return $request === 'blocked-users';. Jeśli odpala się process_request() to znaczy, że match_request() zwróciło true więc ten request chce przechwycić - sprawdzanie w kolejnej funkcji nie ma sensu.
| * Parameters order does not matter. | ||
| */ | ||
| function checkIfUserIsBlocked($fromUserId, $toUserId): bool | ||
| function ifUserIsBlocked(int $fromUserId, int $toUserId): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to może sprawić jednak problem - upewniłbym się czy na przykład po wylogowaniu nie rzuca Ci błędami :) - szczególnie jak próbujesz się ponowaine zalogować.
|
Pobrałem zmiany, zainstalowałem plugin i przy wejściu na stronę wysyłania wiadomości do innego użytkownika (
Idę więc na listę zablokowanych w profilu aktualnie zalogowanego
Dalej nie ma jak sprawdzać. |
event15
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jednak są fatale - tak jak pisałem w komentarzach, że może to sprawić problemy
Finalnie udało się to przenieść na plugin unikając zmian w silniku. Z tamtego PRa zrezygnowałem żeby nie mieszać. Wydaje mi się że wszystko działa, ale jeszcze potestuje.