We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php declare(strict_types=1); |
||
2 | |||
3 | use Smr\Login\Redirect; |
||
4 | use Smr\Pages\Account\InvalidEmail; |
||
5 | use Smr\Pages\Account\InvalidEmailProcessor; |
||
6 | use Smr\Pages\Account\ReopenAccount; |
||
7 | use Smr\Pages\Account\ReopenAccountProcessor; |
||
8 | |||
9 | try { |
||
10 | require_once('../bootstrap.php'); |
||
11 | |||
12 | header('Cache-Control: no-cache, must-revalidate'); |
||
13 | //A date in the past |
||
14 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
||
15 | |||
16 | //xdebug_start_profiling(); |
||
17 | |||
18 | //ob_start(); |
||
19 | |||
20 | // ******************************** |
||
21 | // * |
||
22 | // * c h e c k S e s s i o n |
||
23 | // * |
||
24 | // ******************************** |
||
25 | |||
26 | // do we have a session? |
||
27 | $session = Smr\Session::getInstance(); |
||
28 | if (!$session->hasAccount()) { |
||
29 | header('Location: /login.php'); |
||
30 | exit; |
||
31 | } |
||
32 | |||
33 | // check if we got a sn number with our url |
||
34 | if (empty($session->getSN())) { |
||
35 | create_error('Your browser lost the SN. Try to reload the page!'); |
||
36 | } |
||
37 | |||
38 | // do we have such a container object in the db? |
||
39 | if ($session->hasCurrentVar() === false) { |
||
40 | create_error('Please avoid using the back button!'); |
||
41 | } |
||
42 | $var = $session->getCurrentVar(); |
||
43 | |||
44 | $account = $session->getAccount(); |
||
45 | // get reason for disabled user |
||
46 | $disabled = Redirect::redirectIfDisabled($account); |
||
47 | if ($disabled !== false) { |
||
48 | // save session (incase we forward) |
||
49 | $session->update(); |
||
50 | if ($disabled['Reason'] == CLOSE_ACCOUNT_INVALID_EMAIL_REASON) { |
||
51 | if (!($var instanceof InvalidEmailProcessor)) { |
||
52 | (new InvalidEmail())->go(); |
||
53 | } |
||
54 | // The user has attempted to re-validate their e-mail |
||
55 | // so let this page process normally. |
||
56 | } elseif ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) { |
||
57 | if (!($var instanceof ReopenAccountProcessor)) { |
||
58 | (new ReopenAccount())->go(); |
||
59 | } |
||
60 | // The user has requested to reopen their account |
||
61 | // so let this page process normally. |
||
62 | } else { |
||
63 | throw new Exception('Unexpected disabled reason'); |
||
64 | } |
||
65 | } |
||
66 | |||
67 | do_voodoo(); |
||
68 | } catch (Throwable $e) { |
||
69 | handleException($e); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
70 | } |
||
71 |