Skip to content

Commit 9c881cc

Browse files
committed
Move misc pages to Community namespace
1 parent 003fc59 commit 9c881cc

Some content is hidden

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

46 files changed

+444
-398
lines changed

src/Controllers/Community/Credits.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace BNETDocs\Controllers\Community;
4+
5+
use \BNETDocs\Libraries\Community\Credits as CreditsLib;
6+
7+
class Credits extends \BNETDocs\Controllers\Base
8+
{
9+
/**
10+
* Constructs a Controller, typically to initialize properties.
11+
*/
12+
public function __construct()
13+
{
14+
$this->model = new \BNETDocs\Models\Community\Credits();
15+
}
16+
17+
/**
18+
* Invoked by the Router class to handle the request.
19+
*
20+
* @param array|null $args The optional route arguments and any captured URI arguments.
21+
* @return boolean Whether the Router should invoke the configured View.
22+
*/
23+
public function invoke(?array $args): bool
24+
{
25+
$this->model->_responseCode = \BNETDocs\Libraries\Core\HttpCode::HTTP_OK;
26+
$this->model->top_contributors_by_comments = CreditsLib::getTopContributorsByComments();
27+
$this->model->top_contributors_by_documents = CreditsLib::getTopContributorsByDocuments();
28+
$this->model->top_contributors_by_news_posts = CreditsLib::getTopContributorsByNewsPosts();
29+
$this->model->top_contributors_by_packets = CreditsLib::getTopContributorsByPackets();
30+
$this->model->top_contributors_by_servers = CreditsLib::getTopContributorsByServers();
31+
$this->model->total_users = CreditsLib::getTotalUsers();
32+
return true;
33+
}
34+
}

src/Controllers/Community/Discord.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace BNETDocs\Controllers\Community;
4+
5+
use \BNETDocs\Libraries\Core\HttpCode;
6+
7+
class Discord extends \BNETDocs\Controllers\Base
8+
{
9+
/**
10+
* Constructs a Controller, typically to initialize properties.
11+
*/
12+
public function __construct()
13+
{
14+
$this->model = new \BNETDocs\Models\Community\Discord();
15+
}
16+
17+
/**
18+
* Invoked by the Router class to handle the request.
19+
*
20+
* @param array|null $args The optional route arguments and any captured URI arguments.
21+
* @return boolean Whether the Router should invoke the configured View.
22+
*/
23+
public function invoke(?array $args): bool
24+
{
25+
$config = &\CarlBennett\MVC\Libraries\Common::$config->discord;
26+
27+
$this->model->discord_server_id = $config->server_id;
28+
$this->model->discord_url = \sprintf('https://discord.gg/%s', $config->invite_code);
29+
$this->model->enabled = $config->enabled;
30+
31+
$this->model->_responseCode = ($this->model->enabled ? HttpCode::HTTP_OK : HttpCode::HTTP_SERVICE_UNAVAILABLE);
32+
return true;
33+
}
34+
}

src/Controllers/Community/Donate.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace BNETDocs\Controllers\Community;
4+
5+
class Donate extends \BNETDocs\Controllers\Base
6+
{
7+
/**
8+
* Constructs a Controller, typically to initialize properties.
9+
*/
10+
public function __construct()
11+
{
12+
$this->model = new \BNETDocs\Models\Community\Donate();
13+
}
14+
15+
/**
16+
* Invoked by the Router class to handle the request.
17+
*
18+
* @param array|null $args The optional route arguments and any captured URI arguments.
19+
* @return boolean Whether the Router should invoke the configured View.
20+
*/
21+
public function invoke(?array $args): bool
22+
{
23+
$this->model->donations = \CarlBennett\MVC\Libraries\Common::$config->bnetdocs->donations;
24+
$this->model->_responseCode = \BNETDocs\Libraries\Core\HttpCode::HTTP_OK;
25+
return true;
26+
}
27+
}

src/Controllers/Community/Legal.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace BNETDocs\Controllers\Community;
4+
5+
use \BNETDocs\Libraries\Core\DateTimeImmutable;
6+
use \DateTimeZone;
7+
8+
class Legal extends \BNETDocs\Controllers\Base
9+
{
10+
public const LICENSE_FILE = '../LICENSE.txt';
11+
12+
/**
13+
* Constructs a Controller, typically to initialize properties.
14+
*/
15+
public function __construct()
16+
{
17+
$this->model = new \BNETDocs\Models\Community\Legal();
18+
}
19+
20+
/**
21+
* Invoked by the Router class to handle the request.
22+
*
23+
* @param array|null $args The optional route arguments and any captured URI arguments.
24+
* @return boolean Whether the Router should invoke the configured View.
25+
*/
26+
public function invoke(?array $args): bool
27+
{
28+
$privacy_contact = &\CarlBennett\MVC\Libraries\Common::$config->bnetdocs->privacy->contact;
29+
$this->model->email_domain = $privacy_contact->email_domain;
30+
$this->model->email_mailbox = $privacy_contact->email_mailbox;
31+
32+
$this->model->license = \file_get_contents(self::LICENSE_FILE);
33+
$this->model->license_version = \BNETDocs\Libraries\Core\VersionInfo::$version['bnetdocs'][3] ?? null;
34+
35+
if (!\is_null($this->model->license_version))
36+
{
37+
$this->model->license_version = \explode(' ', $this->model->license_version);
38+
$this->model->license_version[1] = new DateTimeImmutable(
39+
$this->model->license_version[1], new DateTimeZone('Etc/UTC')
40+
);
41+
}
42+
else
43+
{
44+
$this->model->license_version = [];
45+
$this->model->license_version[0] = null;
46+
$this->model->license_version[1] = new DateTimeImmutable(
47+
'@' . \filemtime(self::LICENSE_FILE), new DateTimeZone('Etc/UTC')
48+
);
49+
}
50+
51+
$this->model->_responseCode = \BNETDocs\Libraries\Core\HttpCode::HTTP_OK;
52+
return true;
53+
}
54+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace BNETDocs\Controllers\Community;
4+
5+
class PrivacyPolicy extends \BNETDocs\Controllers\Base
6+
{
7+
/**
8+
* Constructs a Controller, typically to initialize properties.
9+
*/
10+
public function __construct()
11+
{
12+
$this->model = new \BNETDocs\Models\Community\PrivacyPolicy();
13+
}
14+
15+
/**
16+
* Invoked by the Router class to handle the request.
17+
*
18+
* @param array|null $args The optional route arguments and any captured URI arguments.
19+
* @return boolean Whether the Router should invoke the configured View.
20+
*/
21+
public function invoke(?array $args): bool
22+
{
23+
$privacy = &\CarlBennett\MVC\Libraries\Common::$config->bnetdocs->privacy;
24+
$this->model->data_location = $privacy->data_location;
25+
$this->model->email_domain = $privacy->contact->email_domain;
26+
$this->model->email_mailbox = $privacy->contact->email_mailbox;
27+
$this->model->organization = $privacy->organization;
28+
$this->model->_responseCode = \BNETDocs\Libraries\Core\HttpCode::HTTP_OK;
29+
return true;
30+
}
31+
}

src/Controllers/Community/Welcome.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace BNETDocs\Controllers\Community;
4+
5+
class Welcome extends \BNETDocs\Controllers\Base
6+
{
7+
/**
8+
* Constructs a Controller, typically to initialize properties.
9+
*/
10+
public function __construct()
11+
{
12+
$this->model = new \BNETDocs\Models\Community\Welcome();
13+
}
14+
15+
/**
16+
* Invoked by the Router class to handle the request.
17+
*
18+
* @param array|null $args The optional route arguments and any captured URI arguments.
19+
* @return boolean Whether the Router should invoke the configured View.
20+
*/
21+
public function invoke(?array $args): bool
22+
{
23+
$this->model->_responseCode = \BNETDocs\Libraries\Core\HttpCode::HTTP_OK;
24+
return true;
25+
}
26+
}

src/Controllers/Credits.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Controllers/Discord.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Controllers/Donate.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Controllers/Legal.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/Controllers/PrivacyPolicy.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)