Skip to content

Commit da1f1bc

Browse files
authored
fix phpcs (#116)
1 parent dcf43be commit da1f1bc

File tree

73 files changed

+12627
-12003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+12627
-12003
lines changed

adminator3/.php-cs-fixer.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"8.2.18","version":"3.54.0:v3.54.0#2aecbc8640d7906c38777b3dcab6f4ca79004d08","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true},"hashes":{"app\/Middleware\/RedirectIfNotAuthenticated.php":"b9168fda945d0a3adf814aaca3193b09","app\/Middleware\/FlashOldFormDataMiddleware.php":"47c98045e092bb69861d05e7e38eef6a","app\/Middleware\/SessionMiddleware.php":"a2221f363643cb120864f5348b13f7a2","app\/Middleware\/Middleware.php":"ee1a33d2ce887ddfd291994168ff997e","app\/Core\/rss.php":"db0ef2cad25b64b4a33af179309deb43","app\/Core\/Topology.php":"a3c86a86b515bb10020964121e304135","app\/Core\/ArchivZmen.php":"c11271b0dcebe0c508b6c7b65b43bcd4","app\/Core\/Adminator\/Adminator.php":"9942f770783f8a640d332e9eaf4eb8a6","app\/Core\/PagingGlobal.php":"5a57ef8c0c985213e11c932a9eddc63d","app\/Core\/shared\/adminatorGlobal.class.php":"f12682ba519f6ee9d0cb91d8caaa2c9c","app\/Core\/shared\/ros_api_restriction.php":"7d1ec2fbd0445e9fa19b24e6b4edab50","app\/Core\/shared\/vlastnikarchiv.class.php":"137fd3bc221226c935be9891deda45ae","app\/Core\/shared\/c_listing_partner_servis.class.php":"9db12c99a3846518ed08ffe62c3b4472","app\/Core\/shared\/ros_api_qos.php":"8c52a7d81d6d62af922bd89d2a64eda1","app\/Core\/shared\/c_listing_platby.php":"a45005ee10f0d22d7eccfb66fef37f5a","app\/Core\/shared\/c_listing-vlastnici2.php":"d8ad6337857474f756e5557ff8731c3d","app\/Core\/shared\/partner.servis.class.php":"d27cbafd2f9469a55b215d396c07d696","app\/Core\/shared\/c_listing-vlastnici.php":"cee6b02e67b2ccb2ea152ef45e696d40","app\/Core\/shared\/vlastnici2pridani.class.php":"c533d6191ea4c457f7edb896d835c186","app\/Core\/shared\/xml_generator.class.php":"e7fa0b39d99c4348abcb1951cde464d4","app\/Core\/shared\/voip.class.php":"b5888915c26e50a47276c6c3666e268b","app\/Core\/shared\/vlastnik.class.php":"8b6434bb4433819d6de4ab03d0bbe097","app\/Core\/shared\/vlastnikfind.class.php":"eec5f4565848c6ac75316c314ac4d14d","app\/Core\/shared\/c_listing.php":"3a9a3261f9fa518fff9f484dd9e3939f","app\/Core\/shared\/vlastnik2_a2.class.php":"273ac308573ff9b5c8651df428ce76e9","app\/Core\/shared\/fakturacni.class.php":"2d92ba0114d45bb035c4a472e9f3ce07","app\/Core\/Partner\/partner.listing.class.php":"720396997e6d6db8e06a78d292d7456d","app\/Core\/Partner\/partner.class.php":"e1962fce6a88726a11143562ba8fe780","app\/Core\/Item\/objektypridani.class.php":"f63fe00d9873cc9955408af7e485db5c","app\/Core\/Item\/stb.class.php":"5969a7cad1cb6c64a45ba1e4ed93063a","app\/Core\/Item\/c_listing-objekty.php":"56c237f86e3dc70e0bf9ed4a12c5ecdf","app\/Core\/Item\/objekt.class.php":"3c34672a86f1928da494226a398bbc74","app\/Core\/print_reg_form.php":"80477cdbf5b3087924c04bd76e2ee06d","app\/Core\/board.php":"ac647f5f3ddff67807e2bc40078c9155","app\/Core\/opravy.php":"ae61a1bb2b561dab039261581947a911","app\/Core\/admin.php":"e219e0880e6f4aa6282f098dc9871b3d","app\/Core\/platby.php":"805d3f1c16aec127cfb4b15065a2c02a","app\/Core\/TopologyListing.php":"a76f0be231a7d3daf3e2c741435ff1ab","app\/Core\/Customer\/fakturacniSkupiny.class.php":"5a9cc8a3a8949529f29ae3f8c65f6b5f","app\/Core\/Customer\/vlastnik2.class.php":"205531fb50686da890e9f4a41615eee6","app\/Core\/ArchivZmenUcetni.php":"3e006f6c96688e722c1b50cbec6bcf54","app\/Auth\/Password.php":"eabc8ff17d5c1df4aa598073ce6b9ff3","app\/Auth\/serviceHelper.php":"88d43ab25954081073b2add6843163c1","app\/Models\/Stb.php":"0f5371efae7eb6ce42648070a6dd0c2f","app\/Models\/ArchivZmen.php":"59420eb008559ccbfab4953232ec91df","app\/Models\/User.php":"7bc7ef8710013a911ff2ae10f1942f2c","app\/Models\/PartnerOrder.php":"6e8048b2689bf8a6c0fea48dfa46157a","app\/Models\/FakturacniSkupina.php":"65bb70c9b8b15a299880a0ba2ff379e1","app\/Models\/UserPersistence.php":"b02df06cb5ae0afe0b2ea3ab8ae834fa","app\/Models\/UserEmail.php":"2a8c606a0a2c152ba5e398ea727b745c","app\/Models\/PageLevel.php":"b91c10442be4c771317bd745f053b9bc","app\/bootstrap.php":"460894c89a5a044a69624c3d395ee1d0","app\/routing.php":"f5ce71f0b67a91fba6fb89913e4ad255","app\/View\/CsrfRuntime.php":"0c07aec21d68e49ea58826e12f883480","app\/View\/CsrfExtension.php":"93ee2e46b6b24ba2495047c1e56e06b8","app\/Controllers\/adminController.php":"a80d1ae2e62420f1664bbc7e2ed660eb","app\/Controllers\/HomeController.php":"f8bafd73df927021ec0bfd3b46c147f1","app\/Controllers\/aboutController.php":"ef9b15e08a8bbbadd9f0f2e6bceffe79","app\/Controllers\/Controller.php":"2b540036baba4b8fe8c8861a66028d1a","app\/Controllers\/Auth\/AuthController.php":"85e677c1e6508db5f9ccb9308de06eb9","app\/Controllers\/Auth\/PasswordController.php":"d174d1c2cde4f050ea9db3d8a897b327","app\/Controllers\/othersController.php":"e84a7a20221c2bdd19681fea71731323","app\/Controllers\/objektyController.php":"c126709819669408cd6b284153abfc3c","app\/Controllers\/adminatorController.php":"77bd78f6467672cdfc9c93d25e412818","app\/Controllers\/topologyController.php":"65ea2cf9dbe4da9be8404458f9c6b87a","app\/Controllers\/platbyController.php":"4354a03e0100e8e4fbc87494bd5d88b4","app\/Controllers\/workController.php":"b415b0d04f49ccd544752f3d0e46f7fb","app\/Controllers\/partnerController.php":"aa09afc11730efd1443b7796b0381683","app\/Controllers\/vlastniciController.php":"36cbf68de2d7d802c3e88e057a84e903","app\/Controllers\/archivZmenController.php":"a146f3b02241022d878106ca3e46ba2f","app\/Migration\/Migration.php":"a201e0e42b3edc39f1a89d6fd65930eb","app\/cli-config.php":"c1fc939dcbc8a85406d4188215d85c13","app\/Validation\/Validator.php":"f56d1d106da482020def35eb7a8afdc5"}}

adminator3/app/Auth/Password.php

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,52 @@
99

1010
class passwordHelper
1111
{
12-
var $requestData;
12+
public $requestData;
1313

14-
var $loggedUserData;
14+
public $loggedUserData;
1515

16-
var $errorMessage;
16+
public $errorMessage;
1717

1818
protected $validator;
1919

2020
protected $logger;
2121

22-
function __construct(ContainerInterface $container, $requestData) {
22+
public function __construct(ContainerInterface $container, $requestData)
23+
{
2324
$this->container = $container;
2425
$this->logger = $container->get('logger');
2526
$this->validator = $container->get('validator');
2627

2728
$this->requestData = $requestData;
28-
}
29+
}
2930

30-
function validatePassword(){
31+
public function validatePassword()
32+
{
3133

3234
// $this->logger->debug("passwordHelper\changePassword dump current form data: " . var_export($this->requestData['password_old'],true));
3335

3436
$validationOld = $this->validator->validatePassword($this->requestData['password_old'], $this->loggedUserData['password']);
3537

36-
$this->logger->debug("PasswordController\postChangePassword: validationOld for user: "
37-
. var_export($this->loggedUserData['email'], true)
38-
. " returned: " . var_export($validationOld, true));
38+
$this->logger->debug(
39+
"PasswordController\postChangePassword: validationOld for user: "
40+
. var_export($this->loggedUserData['email'], true)
41+
. " returned: " . var_export($validationOld, true)
42+
);
3943

4044
if ($validationOld === false) {
4145
$this->errorMessage = 'Wrong current password.';
4246
return false;
43-
}
47+
}
4448

4549
// https://respect-validation.readthedocs.io/en/2.3/08-list-of-rules-by-category/
4650
$validationNew = $this->validator->validate(
47-
array('password' => $this->requestData['password']),
48-
[
51+
array('password' => $this->requestData['password']),
52+
[
4953
'password' => v::noWhitespace()->notEmpty()->length(7, null),
5054
],
51-
" ",
52-
" "
53-
);
55+
" ",
56+
" "
57+
);
5458

5559
if ($validationNew->failed()) {
5660
$valResults = $validationNew->getErrors();
@@ -60,12 +64,13 @@ function validatePassword(){
6064

6165
return false;
6266
}
63-
67+
6468
return true;
6569
}
6670

67-
function changePassword(){
68-
71+
public function changePassword()
72+
{
73+
6974
$this->loggedUserData = array(
7075
"email" => (string) Sentinel::getUser()->email,
7176
"password" => (string) Sentinel::getUser()->password
@@ -74,7 +79,7 @@ function changePassword(){
7479

7580
$valRes = $this->validatePassword();
7681

77-
if($valRes === false){
82+
if($valRes === false) {
7883
return false;
7984
}
8085

@@ -84,14 +89,13 @@ function changePassword(){
8489
$affRows = User::where('email', $this->loggedUserData['email'])
8590
->update(['password' => $pwHash]);
8691

87-
if($affRows <> 1){
92+
if($affRows <> 1) {
8893
$this->errorMessage = 'Update password failed! Database error.' . "(affected rows: " . $affRows . ")";
8994
return false;
90-
}
91-
else{
95+
} else {
9296
$this->logger->info("PasswordController\changePassword: password successfully changed for user " . var_export($this->loggedUserData['email'], true));
9397
}
9498

9599
return true;
96100
}
97-
}
101+
}

adminator3/app/Auth/serviceHelper.php

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,46 @@
44

55
use Cartalyst\Sentinel\Native\Facades\Sentinel;
66

7-
class auth_service{
7+
class auth_service
8+
{
9+
public $conn_mysql;
810

9-
var $conn_mysql;
11+
public $smarty;
12+
public $logger;
1013

11-
var $smarty;
12-
var $logger;
14+
public $user_nick;
1315

14-
var $user_nick;
16+
public $user_level;
1517

16-
var $user_level;
18+
public $user_sid;
1719

18-
var $user_sid;
20+
public $page_level_id; // IDcko, dle ktereho zjistime, jestli user ma dostatecny level
1921

20-
var $page_level_id; // IDcko, dle ktereho zjistime, jestli user ma dostatecny level
22+
public $page_level_id_cxustom; // IDcko ala page_level_id ale pro jinou stranku/sub-page
2123

22-
var $page_level_id_cxustom; // IDcko ala page_level_id ale pro jinou stranku/sub-page
24+
public $check_auth_no_die;
2325

24-
var $check_auth_no_die;
25-
26-
function __construct($container, $conn_mysql, $smarty, $logger) {
26+
public function __construct($container, $conn_mysql, $smarty, $logger)
27+
{
2728
$this->container = $container;
2829
$this->conn_mysql = $conn_mysql;
2930
$this->smarty = $smarty;
3031
$this->logger = $logger;
3132
}
32-
33-
public function checkLevel($page_level_id = 0, $adminator = null){
3433

35-
if(is_object($adminator))
36-
{
34+
public function checkLevel($page_level_id = 0, $adminator = null)
35+
{
36+
37+
if(is_object($adminator)) {
3738
$a = $adminator;
38-
}
39-
else
40-
{
39+
} else {
4140
$a = new \App\Core\adminator($this->conn_mysql, $this->smarty, $this->logger);
4241
}
4342

4443
$auth_identity = Sentinel::getUser()->email;
4544
$this->logger->debug("adminatorController\\check_level getIdentity: ".var_export($auth_identity, true));
4645

47-
if ($page_level_id == 0){
46+
if ($page_level_id == 0) {
4847
$this->renderNoLogin();
4948
return false;
5049
}
@@ -53,24 +52,24 @@ public function checkLevel($page_level_id = 0, $adminator = null){
5352
$a->userIdentityUsername = $auth_identity;
5453

5554
$checkLevel = $a->checkLevel();
56-
55+
5756
$this->logger->info("adminatorController\checkLevel: checkLevel result: ".var_export($checkLevel, true));
5857

59-
if($checkLevel === false){
58+
if($checkLevel === false) {
6059
$this->renderNoLogin();
6160
return false;
6261
}
6362
}
6463

65-
public function renderNoLogin ()
64+
public function renderNoLogin()
6665
{
67-
$this->smarty->assign("page_title","Adminator3 - chybny level");
66+
$this->smarty->assign("page_title", "Adminator3 - chybny level");
6867

6968
// $this->header();
7069

71-
$this->smarty->assign("body","<br>Neopravneny pristup /chyba pristupu. STOP <br>");
70+
$this->smarty->assign("body", "<br>Neopravneny pristup /chyba pristupu. STOP <br>");
7271
$this->smarty->display('global/no-level.tpl');
73-
72+
7473
exit;
7574
}
76-
}
75+
}

adminator3/app/Controllers/Auth/AuthController.php

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
class AuthController extends Controller
1616
{
17-
18-
var $logger;
17+
public $logger;
1918

2019
/**
2120
* @var Messages
@@ -27,7 +26,7 @@ class AuthController extends Controller
2726
*/
2827
protected RouteParserInterface $routeParser;
2928

30-
/**
29+
/**
3130
* @var Twig
3231
*/
3332
protected Twig $view;
@@ -36,37 +35,38 @@ public function __construct(
3635
ContainerInterface $container,
3736
Messages $flash,
3837
RouteParserInterface $routeParser,
39-
)
40-
{
38+
) {
4139
$this->container = $container;
4240
$this->routeParser = $routeParser;
4341
$this->flash = $container->get('flash');
4442
$this->logger = $container->get('logger');
4543
$this->view = $container->get('view');
4644

4745
$this->logger->info("authController\__construct called");
48-
}
46+
}
4947

50-
public function signin(ServerRequestInterface $request, ResponseInterface $response, array $args)
51-
{
52-
if ($request->getMethod() == "POST")
53-
{
48+
public function signin(ServerRequestInterface $request, ResponseInterface $response, array $args)
49+
{
50+
if ($request->getMethod() == "POST") {
5451
$data = array(
5552
'email' => $request->getParsedBody()['slimUsername'],
5653
'password' => $request->getParsedBody()['slimPassword'],
5754
);
5855

5956
try {
60-
if (
61-
!Sentinel::authenticate($this->array_clean($data, [
62-
'email',
63-
'password',
64-
]), isset($data['persist']))
57+
if (!Sentinel::authenticate(
58+
$this->array_clean(
59+
$data,
60+
[
61+
'email',
62+
'password',
63+
]
64+
),
65+
isset($data['persist'])
66+
)
6567
) {
6668
throw new Exception('Incorrect email or password.');
67-
}
68-
else
69-
{
69+
} else {
7070
$url = $this->routeParser->urlFor('home');
7171
return $response->withStatus(302)->withHeader('Location', $url);
7272
}
@@ -76,13 +76,11 @@ public function signin(ServerRequestInterface $request, ResponseInterface $respo
7676
}
7777
}
7878

79-
if (isset($this->flash->getMessages()["oldNow"][0]['slimUsername'])){
79+
if (isset($this->flash->getMessages()["oldNow"][0]['slimUsername'])) {
8080
$username = $this->flash->getMessages()["oldNow"][0]['slimUsername'];
81-
}
82-
elseif(isset($this->flash->getMessages()["old"][0]['slimUsername']) ){
81+
} elseif(isset($this->flash->getMessages()["old"][0]['slimUsername'])) {
8382
$username = $this->flash->getMessages()["old"][0]['slimUsername'];
84-
}
85-
else{
83+
} else {
8684
$username = null;
8785
}
8886

@@ -91,35 +89,34 @@ public function signin(ServerRequestInterface $request, ResponseInterface $respo
9189
// echo "<pre>END OLD NOW: " . var_export($this->flash->getMessages()["oldNow"], true) . "</pre>";
9290

9391
return $this->view->render($response, 'auth\signin.twig', array('username' => @$username));
94-
}
92+
}
9593

96-
public function signout($request, $response, array $args)
97-
{
94+
public function signout($request, $response, array $args)
95+
{
9896
$this->logger->info("AuthController/signout called");
9997
$this->logger->debug("AuthController/signout: dump user identity: ".var_export(Sentinel::getUser()->email, true));
100-
98+
10199
if (!Sentinel::guest()) {
102100
$rs = sentinel::logout();
103101
$this->logger->info("AuthController/signout: signout action result: " . var_export($rs, true));
104-
}
105-
else{
102+
} else {
106103
$this->logger->info("AuthController/signout: user is not logged, redirecting to home");
107104
}
108105

109106
//redirect
110107
$url = $this->routeParser->urlFor('home');
111108
return $response->withStatus(302)->withHeader('Location', $url);
112-
}
109+
}
113110

114111
/**
115112
* @param array $array The array
116113
* @param array $keys The keys
117114
*
118115
* @return array
119116
*/
120-
function array_clean(array $array, array $keys): array
117+
public function array_clean(array $array, array $keys): array
121118
{
122119
return array_intersect_key($array, array_flip($keys));
123120
}
124121

125-
}
122+
}

0 commit comments

Comments
 (0)