Skip to content

Commit

Permalink
Merge pull request #2541 from phili67/phili67-system-infos
Browse files Browse the repository at this point in the history
Phili67 system infos
  • Loading branch information
phili67 authored Feb 16, 2024
2 parents 1bde306 + e9c9f35 commit ecdfaec
Show file tree
Hide file tree
Showing 8 changed files with 465 additions and 610 deletions.
284 changes: 183 additions & 101 deletions src/EcclesiaCRM/Service/AppIntegrityService.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/EcclesiaCRM/Service/SystemService.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static public function getPackageMainVersion() // the main part of the version 2
return strstr(self::getInstalledVersion(),".",true);
}

public function getDBServerVersion()
static public function getDBServerVersion()
{
try{
return Propel::getServiceContainer()->getConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
Expand Down
50 changes: 14 additions & 36 deletions src/EcclesiaCRM/VIEWControllers/VIEWSystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ public function integritycheck (ServerRequest $request, Response $response, arra
return $renderer->render($response, 'integritycheck.php', $this->argumentsIntegrityCheckArray());
}

public function infos (ServerRequest $request, Response $response, array $args): Response
{
$renderer = new PhpRenderer('templates/system/');

//Set the page title
if (!SessionUser::getUser()->isAdmin()) {
return $response->withStatus(302)->withHeader('Location', SystemURLs::getRootPath() . '/v2/dashboard');
}

return $renderer->render($response, 'infos.php', $this->argumentsIntegrityCheckArray());
}

public function argumentsIntegrityCheckArray ()
{
//Set the page title
$sPageTitle = _('Integrity Check Results');
$sPageTitle = _('System Infos');


$sRootDocument = SystemURLs::getDocumentRoot();
Expand Down Expand Up @@ -246,39 +258,5 @@ public function argumentsEventAttendanceArray ($Action, $Event, $Type, $Choice)
];

return $paramsArguments;
}



public function USISTAddressVerification (ServerRequest $request, Response $response, array $args): Response
{
$renderer = new PhpRenderer('templates/system/');

if (!SessionUser::getUser()->isAdmin()) {
return $response->withStatus(302)->withHeader('Location', SystemURLs::getRootPath() . '/v2/dashboard');
}

$DoLookup = '';
if (isset($args['DoLookup'])) {
$DoLookup = InputUtils::LegacyFilterInput($args['DoLookup']);
}

return $renderer->render($response, 'USISTAddressVerification.php', $this->argumentsUSISTAddressVerificationArray($DoLookup));
}

public function argumentsUSISTAddressVerificationArray ($DoLookup)
{
//Set the page title
$sPageTitle = _('US Address Verification');

$paramsArguments = ['sRootPath' => SystemURLs::getRootPath(),
'sRootDocument' => SystemURLs::getDocumentRoot(),
'CSPNonce' => SystemURLs::getCSPNonce(),
'sPageTitle' => $sPageTitle,
'DoLookup' => $DoLookup
];

return $paramsArguments;
}

}
}
12 changes: 12 additions & 0 deletions src/Include/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ class="tab-content p-3 control-sidebar-content os-host os-theme-light os-host-re
</div>
<?php
}
if (SessionUser::getUser()->isAdmin()) {
?>
<div class="mb-1">
<a href="<?= SystemURLs::getRootPath() ?>/v2/system/infos">
<i class="menu-icon fas fa-info bg-gradient-info"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading"><?= _('System Infos') ?></h4>
</div>
</a>
</div>
<?php
}
?>
<hr/>

Expand Down
6 changes: 5 additions & 1 deletion src/setup/routes/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

$group->get('SystemPrerequisiteCheck', function (ServerRequest $request, Response $response, array $args) {
$required = EcclesiaCRM\Service\AppIntegrityService::getApplicationPrerequisites();
return $response->withStatus(200)->withJson($required);
$requiredArray = [];
foreach ($required as $require) {
$requiredArray[$require->getName()] = $require->getMessage();
}
return $response->withStatus(200)->withJson($requiredArray);
});

$group->post('checkDatabaseConnection', function (ServerRequest $request, Response $response, array $args) {
Expand Down
7 changes: 2 additions & 5 deletions src/v2/routes/system/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

$app->group('/system', function (RouteCollectorProxy $group) {
$group->get('/integritycheck', VIEWSystemController::class . ':integritycheck' );
$group->get('/infos', VIEWSystemController::class . ':infos' );

$group->get('/report/list', VIEWSystemController::class . ':reportList' );
$group->post('/report/list', VIEWSystemController::class . ':reportList' );
Expand Down Expand Up @@ -44,11 +45,7 @@
* #! param: ref->string :: Source -> cart
*/
$group->get('/event/attendance/{Action}/{Event:[0-9]+}/{Type}[/{Choice}]', VIEWSystemController::class . ':eventAttendance' );
$group->post('/event/attendance/{Action}/{Event:[0-9]+}/{Type}[/{Choice}]', VIEWSystemController::class . ':eventAttendance' );

$group->get('/USISTAddress/Verification[/{DoLookup}]', VIEWSystemController::class . ':USISTAddressVerification' );
$group->post('/USISTAddress/Verification[/{DoLookup}]', VIEWSystemController::class . ':USISTAddressVerification' );

$group->post('/event/attendance/{Action}/{Event:[0-9]+}/{Type}[/{Choice}]', VIEWSystemController::class . ':eventAttendance' );
});


Loading

0 comments on commit ecdfaec

Please sign in to comment.