-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4143a75
commit 721d9da
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Plugins\Admin; | ||
|
||
use AntCMS\AntPlugin; | ||
use AntCMS\AntConfig; | ||
use AntCMS\AntTools; | ||
use AntCMS\AntCMS; | ||
use AntCMS\AntTwig; | ||
use AntCMS\AntAuth; | ||
use AntCMS\AntUsers; | ||
|
||
class Admin extends AntPlugin | ||
{ | ||
protected AntAuth $antAuth; | ||
protected AntTwig $antTwig; | ||
protected array $params = [ | ||
'AntCMSTitle' => 'AntCMS Admin Dashboard', | ||
'AntCMSDescription' => 'The AntCMS admin dashboard', | ||
'AntCMSAuthor' => 'AntCMS', | ||
'AntCMSKeywords' => '', | ||
|
||
]; | ||
|
||
public function __construct() | ||
{ | ||
$this->antAuth = new AntAuth; | ||
$this->antTwig = new AntTwig; | ||
$this->antAuth->checkAuth(); | ||
} | ||
|
||
public function renderIndex() | ||
{ | ||
$this->params['user'] = AntUsers::getUserPublicalKeys($this->antAuth->getUsername()); | ||
|
||
$response = $this->response; | ||
$response->getBody()->write($this->antTwig->renderWithSubLayout('admin_landing', $this->params)); | ||
return $response; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return 'Admin'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
private function boolToWord(bool $value) | ||
{ | ||
return $value ? 'true' : 'false'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Plugins\Admin; | ||
|
||
use \Slim\App; | ||
use Psr\Http\Message\ResponseInterface as Response; | ||
use Psr\Http\Message\ServerRequestInterface as Request; | ||
|
||
class Controller | ||
{ | ||
public function registerRoutes(App $app) | ||
{ | ||
$profilePlugin = new Admin; | ||
|
||
$app->get('/admin', function (Request $request, Response $response) use ($profilePlugin) { | ||
$profilePlugin->setRequest($request); | ||
$profilePlugin->SetResponse($response); | ||
return $profilePlugin->renderIndex(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters