@@ -5,9 +5,9 @@ |
||
5 | 5 | use Symfony\Component\ErrorHandler\Debug; |
6 | 6 | use Symfony\Component\HttpFoundation\Request; |
7 | 7 | |
8 | -require dirname(__DIR__).'/vendor/autoload.php'; |
|
8 | +require dirname(__DIR__) . '/vendor/autoload.php'; |
|
9 | 9 | |
10 | -(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); |
|
10 | +(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); |
|
11 | 11 | |
12 | 12 | if ($_SERVER['APP_DEBUG']) { |
13 | 13 | umask(0000); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | private $notifications_bcc; |
47 | 47 | |
48 | 48 | public function __construct(MailerInterface $mailer, TranslatorInterface $translator, |
49 | - PaymentOrderPDFGenerator $paymentOrderPDFGenerator, EntityManagerInterface $entityManager, string $fsb_email, |
|
49 | + PaymentOrderPDFGenerator $paymentOrderPDFGenerator, EntityManagerInterface $entityManager, string $fsb_email, |
|
50 | 50 | bool $send_notifications, array $notifications_bcc) |
51 | 51 | { |
52 | 52 | $this->mailer = $mailer; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function sendUserEmail(PaymentOrderSubmittedEvent $event): void |
64 | 64 | { |
65 | 65 | //Do nothing if notifications are disabled |
66 | - if(!$this->send_notifications) { |
|
66 | + if (!$this->send_notifications) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $email = new TemplatedEmail(); |
77 | 77 | |
78 | - if(!empty($this->notifications_bcc) && $this->notifications_bcc[0] !== null) { |
|
78 | + if (!empty($this->notifications_bcc) && $this->notifications_bcc[0] !== null) { |
|
79 | 79 | $email->addBcc(...$this->notifications_bcc); |
80 | 80 | } |
81 | 81 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->mailer->send($email); |
97 | 97 | } |
98 | 98 | |
99 | - public function generatePDF(PaymentOrderSubmittedEvent $event ): void |
|
99 | + public function generatePDF(PaymentOrderSubmittedEvent $event): void |
|
100 | 100 | { |
101 | 101 | $payment_order = $event->getPaymentOrder(); |
102 | 102 | $pdf_content = $this->paymentOrderPDFGenerator->generatePDF($payment_order); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $form->handleRequest($request); |
75 | 75 | |
76 | - if($form->isSubmitted() && $form->isValid()) { |
|
76 | + if ($form->isSubmitted() && $form->isValid()) { |
|
77 | 77 | |
78 | 78 | //Determine the Values to use |
79 | 79 | $data = $form->getData(); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | //Set export flag |
129 | - foreach($payment_orders as $paymentOrder) { |
|
129 | + foreach ($payment_orders as $paymentOrder) { |
|
130 | 130 | $paymentOrder->setExported(true); |
131 | 131 | } |
132 | 132 | $this->entityManager->flush(); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | { |
152 | 152 | $response = new Response(); |
153 | 153 | $response->headers->set('Cache-Control', 'private'); |
154 | - $response->headers->set('Content-type', $mime_type); |
|
154 | + $response->headers->set('Content-type', $mime_type); |
|
155 | 155 | $response->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '";'); |
156 | - $response->headers->set('Content-length', strlen($content)); |
|
157 | - $response->setContent( $content); |
|
156 | + $response->headers->set('Content-length', strlen($content)); |
|
157 | + $response->setContent($content); |
|
158 | 158 | return $response; |
159 | 159 | } |
160 | 160 | } |
161 | 161 | \ No newline at end of file |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | //Handle 2FA things |
70 | 70 | $google_form = $this->createForm(TFAGoogleSettingsType::class, $user); |
71 | 71 | $google_enabled = $user->isGoogleAuthenticatorEnabled(); |
72 | - if (! $google_enabled && ! $google_form->isSubmitted()) { |
|
72 | + if (!$google_enabled && !$google_form->isSubmitted()) { |
|
73 | 73 | $user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret()); |
74 | 74 | $google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret()); |
75 | 75 | } |
76 | 76 | $google_form->handleRequest($request); |
77 | 77 | |
78 | 78 | if ($google_form->isSubmitted() && $google_form->isValid()) { |
79 | - if (! $google_enabled) { |
|
79 | + if (!$google_enabled) { |
|
80 | 80 | //Save 2FA settings (save secrets) |
81 | 81 | $user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData()); |
82 | 82 | $backupCodeManager->enableBackupCodes($user); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | //When user change its settings, he should be logged in fully. |
122 | 122 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
123 | 123 | |
124 | - if (! $user instanceof User) { |
|
124 | + if (!$user instanceof User) { |
|
125 | 125 | throw new \RuntimeException('This controller only works only for Part-DB User objects!'); |
126 | 126 | } |
127 | 127 | |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | //When user change its settings, he should be logged in fully. |
148 | 148 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
149 | 149 | |
150 | - if (! $user instanceof User) { |
|
150 | + if (!$user instanceof User) { |
|
151 | 151 | throw new \RuntimeException('This controller only works only for Part-DB User objects!'); |
152 | 152 | } |
153 | 153 | |
154 | - if ($this->isCsrfTokenValid('regenerate_backup_codes'.$user->getId(), $request->request->get('_token'))) { |
|
154 | + if ($this->isCsrfTokenValid('regenerate_backup_codes' . $user->getId(), $request->request->get('_token'))) { |
|
155 | 155 | $backupCodeManager->regenerateBackupCodes($user); |
156 | 156 | $entityManager->flush(); |
157 | 157 | $this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated'); |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | //When user change its settings, he should be logged in fully. |
175 | 175 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
176 | 176 | |
177 | - if (! $user instanceof User) { |
|
177 | + if (!$user instanceof User) { |
|
178 | 178 | throw new \RuntimeException('This controller only works only for Part-DB User objects!'); |
179 | 179 | } |
180 | 180 | |
181 | - if ($this->isCsrfTokenValid('devices_reset'.$user->getId(), $request->request->get('_token'))) { |
|
181 | + if ($this->isCsrfTokenValid('devices_reset' . $user->getId(), $request->request->get('_token'))) { |
|
182 | 182 | $user->invalidateTrustedDevices(); |
183 | 183 | $entityManager->flush(); |
184 | 184 | $this->addFlash('success', 'tfa_trustedDevice.invalidate.success'); |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | //Redirect to homepage, if no further paymentOrders should be submitted |
77 | 77 | //Otherwise create a new form for further ones |
78 | - if($form->getClickedButton()->getName() === "submit") { |
|
78 | + if ($form->getClickedButton()->getName() === "submit") { |
|
79 | 79 | return $this->redirectToRoute('homepage'); |
80 | - } else if($form->getClickedButton()->getName() === "submit_new") { |
|
80 | + } else if ($form->getClickedButton()->getName() === "submit_new") { |
|
81 | 81 | $old_order = $new_order; |
82 | 82 | $new_order = new PaymentOrder(); |
83 | 83 | $this->copyProperties($old_order, $new_order); |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | $given_token = (string) $request->query->get('token'); |
129 | - if(!password_verify($given_token, $correct_token)) { |
|
129 | + if (!password_verify($given_token, $correct_token)) { |
|
130 | 130 | $this->addFlash('error', 'payment_order.confirmation.invalid_token'); |
131 | 131 | return $this->redirectToRoute('homepage'); |
132 | 132 | } |
133 | 133 | |
134 | 134 | //Check if it was already confirmed from this side and disable form if needed |
135 | 135 | $confirm_timestamp = $confirm_step === 1 ? $paymentOrder->getConfirm1Timestamp() : $paymentOrder->getConfirm2Timestamp(); |
136 | - if($confirm_timestamp !== null) { |
|
136 | + if ($confirm_timestamp !== null) { |
|
137 | 137 | $this->addFlash('info', 'payment_order.confirmation.already_confirmed'); |
138 | 138 | } |
139 | 139 | $form = $this->createForm(PaymentOrderConfirmationType::class, null, [ |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | ]); |
142 | 142 | |
143 | 143 | $form->handleRequest($request); |
144 | - if($form->isSubmitted() && $form->isValid()) |
|
144 | + if ($form->isSubmitted() && $form->isValid()) |
|
145 | 145 | { |
146 | 146 | $this->addFlash('success', 'payment_order.confirmation.success'); |
147 | 147 | //Write confirmation to DB |
148 | - if($confirm_step === 1) { |
|
148 | + if ($confirm_step === 1) { |
|
149 | 149 | $paymentOrder->setConfirm1Timestamp(new \DateTime()); |
150 | 150 | } elseif ($confirm_step === 2) { |
151 | 151 | $paymentOrder->setConfirm2Timestamp(new \DateTime()); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | private function checkPermission(PaymentOrder $paymentOrder, Request $request): void |
75 | 75 | { |
76 | 76 | //Check if a valid confirmation token was given, then give access without proper role |
77 | - if($request->query->has('token') && $request->query->has('confirm')) { |
|
77 | + if ($request->query->has('token') && $request->query->has('confirm')) { |
|
78 | 78 | //Check if we have one of the valid confirm numbers |
79 | 79 | $confirm_step = $request->query->getInt('confirm', 0); |
80 | 80 | if ($confirm_step !== 1 && $confirm_step !== 2) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $given_token = (string) $request->query->get('token'); |
91 | - if(password_verify($given_token, $correct_token)) { |
|
91 | + if (password_verify($given_token, $correct_token)) { |
|
92 | 92 | //If password is correct, skip role checking. |
93 | 93 | return; |
94 | 94 | } |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | public function configureActions(Actions $actions): Actions |
52 | 52 | { |
53 | 53 | $actions->setPermissions([ |
54 | - Action::EDIT => 'ROLE_EDIT_USER', |
|
55 | - Action::DELETE => 'ROLE_EDIT_USER', |
|
56 | - Action::NEW => 'ROLE_EDIT_USER', |
|
57 | - Action::INDEX => 'ROLE_READ_USER', |
|
58 | - Action::DETAIL => 'ROLE_READ_USER' |
|
59 | - ]); |
|
54 | + Action::EDIT => 'ROLE_EDIT_USER', |
|
55 | + Action::DELETE => 'ROLE_EDIT_USER', |
|
56 | + Action::NEW => 'ROLE_EDIT_USER', |
|
57 | + Action::INDEX => 'ROLE_READ_USER', |
|
58 | + Action::DETAIL => 'ROLE_READ_USER' |
|
59 | + ]); |
|
60 | 60 | |
61 | 61 | return parent::configureActions($actions); // TODO: Change the autogenerated stub |
62 | 62 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | ->setEntityLabelInSingular('user.label') |
68 | 68 | ->setEntityLabelInPlural('user.labelp') |
69 | 69 | ->setFormOptions([ |
70 | - 'validation_groups' => ['Default', 'perm_edit'], |
|
71 | - ]) |
|
70 | + 'validation_groups' => ['Default', 'perm_edit'], |
|
71 | + ]) |
|
72 | 72 | ->setSearchFields(['id', 'username', 'role_description', 'email', 'roles', 'first_name', 'last_name']); |
73 | 73 | } |
74 | 74 |
@@ -172,10 +172,10 @@ |
||
172 | 172 | ->setName((string) $user) |
173 | 173 | ->displayUserName(true) |
174 | 174 | ->addMenuItems([ |
175 | - MenuItem::linktoRoute('user.settings.title', 'fas fa-user-cog', 'user_settings'), |
|
176 | - MenuItem::linktoRoute(Languages::getName('de', 'de') . ' (DE)', '', 'admin_dashboard.de'), |
|
177 | - MenuItem::linktoRoute(Languages::getName('en', 'en') . ' (EN)', '', 'admin_dashboard.en'), |
|
178 | - ]); |
|
175 | + MenuItem::linktoRoute('user.settings.title', 'fas fa-user-cog', 'user_settings'), |
|
176 | + MenuItem::linktoRoute(Languages::getName('de', 'de') . ' (DE)', '', 'admin_dashboard.de'), |
|
177 | + MenuItem::linktoRoute(Languages::getName('en', 'en') . ' (EN)', '', 'admin_dashboard.en'), |
|
178 | + ]); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | public function configureCrud(): Crud |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'confirmed' => 1, |
94 | 94 | ]); |
95 | 95 | |
96 | - $ready_for_export_section = MenuItem::linkToCrud('payment_order.ready_for_export.section', '',PaymentOrder::class) |
|
96 | + $ready_for_export_section = MenuItem::linkToCrud('payment_order.ready_for_export.section', '', PaymentOrder::class) |
|
97 | 97 | ->setDefaultSort(['creation_date' => 'ASC']); |
98 | 98 | $this->addFiltersToMenuItem($ready_for_export_section, [ |
99 | 99 | 'mathematically_correct' => 1, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ]); |
103 | 103 | |
104 | 104 | |
105 | - $factually_checking_fsr = MenuItem::linkToCrud('payment_order.factually_checking_needed.fsr', '',PaymentOrder::class) |
|
105 | + $factually_checking_fsr = MenuItem::linkToCrud('payment_order.factually_checking_needed.fsr', '', PaymentOrder::class) |
|
106 | 106 | ->setDefaultSort(['creation_date' => 'ASC']); |
107 | 107 | $this->addFiltersToMenuItem($factually_checking_fsr, [ |
108 | 108 | 'factually_correct' => 0, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'confirmed' => 1, |
112 | 112 | ]); |
113 | 113 | |
114 | - $factually_checking_section = MenuItem::linkToCrud('payment_order.factually_checking_needed.section', '',PaymentOrder::class) |
|
114 | + $factually_checking_section = MenuItem::linkToCrud('payment_order.factually_checking_needed.section', '', PaymentOrder::class) |
|
115 | 115 | ->setDefaultSort(['creation_date' => 'ASC']); |
116 | 116 | $this->addFiltersToMenuItem($factually_checking_section, [ |
117 | 117 | 'factually_correct' => 0, |
@@ -57,12 +57,12 @@ |
||
57 | 57 | public function configureActions(Actions $actions): Actions |
58 | 58 | { |
59 | 59 | $actions->setPermissions([ |
60 | - Action::EDIT => 'ROLE_EDIT_ORGANISATIONS', |
|
61 | - Action::DELETE => 'ROLE_EDIT_ORGANISATIONS', |
|
62 | - Action::NEW => 'ROLE_EDIT_ORGANISATIONS', |
|
63 | - Action::INDEX => 'ROLE_READ_ORGANISATIONS', |
|
64 | - Action::DETAIL => 'ROLE_READ_ORGANISATIONS', |
|
65 | - ]); |
|
60 | + Action::EDIT => 'ROLE_EDIT_ORGANISATIONS', |
|
61 | + Action::DELETE => 'ROLE_EDIT_ORGANISATIONS', |
|
62 | + Action::NEW => 'ROLE_EDIT_ORGANISATIONS', |
|
63 | + Action::INDEX => 'ROLE_READ_ORGANISATIONS', |
|
64 | + Action::DETAIL => 'ROLE_READ_ORGANISATIONS', |
|
65 | + ]); |
|
66 | 66 | |
67 | 67 | return $actions->add(Crud::PAGE_INDEX, Action::DETAIL); |
68 | 68 | } |
@@ -78,8 +78,8 @@ |
||
78 | 78 | public function configureFields(string $pageName): iterable |
79 | 79 | { |
80 | 80 | $choices = []; |
81 | - foreach(Department::ALLOWED_TYPES as $type) { |
|
82 | - $choices['department.type.' . $type ] = $type; |
|
81 | + foreach (Department::ALLOWED_TYPES as $type) { |
|
82 | + $choices['department.type.' . $type] = $type; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $name = TextField::new('name', 'department.name.label'); |