Skip to content

Commit 3bf2c49

Browse files
committed
Allow donations to BNETDocs
1 parent 8a4eb21 commit 3bf2c49

File tree

8 files changed

+110
-1
lines changed

8 files changed

+110
-1
lines changed

etc/config.sample.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"bnetdocs": {
3+
"btc_donate_address": "",
34
"maintenance": [
45
false,
56
"BNETDocs has to take a brief moment to do some system maintenance. We'll be back shortly."

src/controllers/Donate.php

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;
4+
5+
use \BNETDocs\Libraries\VersionInfo;
6+
use \BNETDocs\Models\Donate as DonateModel;
7+
use \CarlBennett\MVC\Libraries\Common;
8+
use \CarlBennett\MVC\Libraries\Controller;
9+
use \CarlBennett\MVC\Libraries\Router;
10+
use \CarlBennett\MVC\Libraries\View;
11+
use \DateTime;
12+
use \DateTimeZone;
13+
14+
class Donate extends Controller {
15+
16+
public function &run(Router &$router, View &$view, array &$args) {
17+
18+
$model = new DonateModel();
19+
$model->btc_address = Common::$config->bnetdocs->btc_donate_address;
20+
21+
$view->render($model);
22+
23+
$model->_responseCode = 200;
24+
$model->_responseHeaders["Content-Type"] = $view->getMimeType();
25+
$model->_responseTTL = 0;
26+
27+
return $model;
28+
29+
}
30+
31+
}

src/main.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ function main() {
122122
$router->addRoute( // URL: /document/search
123123
"#^/document/search/?$#", "Document\\Search", "Document\\SearchHtml"
124124
);
125+
$router->addRoute( // URL: /donate
126+
"#^/donate/?$#", "Donate", "DonateHtml"
127+
);
125128
$router->addRoute( // URL: /eventlog/index
126129
"#^/eventlog/index/?$#", "EventLog\\Index", "EventLog\\IndexHtml"
127130
);

src/models/Donate.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace BNETDocs\Models;
4+
5+
use \CarlBennett\MVC\Libraries\Model;
6+
7+
class Donate extends Model {
8+
9+
public $btc_address;
10+
11+
}

src/templates/Donate.phtml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace BNETDocs\Templates;
4+
5+
use \CarlBennett\MVC\Libraries\Common;
6+
use \CarlBennett\MVC\Libraries\Pair;
7+
8+
$title = "Donate";
9+
$description = "Donate to BNETDocs to show your support for this project!";
10+
11+
$this->opengraph->attach(new Pair("url", "/donate"));
12+
$this->opengraph->attach(new Pair("type", "article"));
13+
14+
require("./header.inc.phtml");
15+
?>
16+
<article>
17+
<header>Disclaimer</header>
18+
<section>
19+
<p>By donating to BNETDocs, you understand the following:</p>
20+
<p><ol>
21+
<li>The donation is non-refundable.</li>
22+
<li>The donation's purpose is to pay for hosting of this website and all associated costs, and to further the development of open-source software (OSS).</li>
23+
<li>A donation is not acceptable as payment for goods, products, or merchant items.</li>
24+
<li>In absolutely no scenario will a donation be used to willfully violate Blizzard Entertainment's Terms of Service or Battle.net&trade;'s Terms of Service.</li>
25+
</ol></p>
26+
<p>Please see our <a href="<?php echo Common::relativeUrlToAbsolute("/legal"); ?>">Legal Policies</a> for more info.</p>
27+
</section>
28+
<header>Bitcoin (BTC)</header>
29+
<section>
30+
<p>Please send your donation to: <code><?php echo $this->getContext()->btc_address; ?></code></p>
31+
</section>
32+
</article>
33+
<?php require("./footer.inc.phtml"); ?>

src/templates/Legal.phtml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ require("./header.inc.phtml");
5555
</li>
5656
<li>BNETDocs reserves the right to modify this legal page at its own discretion with or without notification to its users.</li>
5757
<li>BNETDocs news posts are considered press articles and all content used within a news post or otherwise news article are considered governed under the United States first amendment and fair use rights.</li>
58-
<li>All questions and concerns related to material on this website or other matter should be communicated to <a href="mailto:[email protected]?subject=Legal%20Matter%20Attn.:%20BNETDocs">[email protected]</a>. Responses to this communication medium are not guaranteed.</li>
58+
<li>A "Donation" as defined further in this document is a transaction of sending currency to BNETDocs.</p>
59+
<li>Donations to BNETDocs are non-refundable and non-transferrable.</li>
60+
<li>Donation's purpose is to pay for hosting of this website and all associated costs, and to further the development of open-source software (OSS).</li>
61+
<li>Donations are not acceptable as payment for goods, products, or merchant items.</li>
62+
<li>In absolutely no scenario will a donation be used to willfully violate Blizzard Entertainment's Terms of Service or Battle.net&trade;'s Terms of Service.</li>
63+
<li>All questions and concerns related to material on this website or other matter should be communicated to <a href="mailto:[email protected]?subject=Legal%20Matter%20Attn.:%20BNETDocs">[email protected]</a>. Responses to this communication medium are not guaranteed due to the volume of emails that may be received.</li>
5964
</ol>
6065
</section>
6166
</article>

src/templates/header.inc.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ if (isset($_SESSION['user_id'])) {
7474
<a href="<?php echo Common::relativeUrlToAbsolute("/credits"); ?>">Contributors</a>
7575
<a href="<?php echo Common::relativeUrlToAbsolute("/servers"); ?>">Server List</a>
7676
<a href="<?php echo Common::relativeUrlToAbsolute("/legal"); ?>">Legal Policies</a>
77+
<a href="<?php echo Common::relativeUrlToAbsolute("/donate"); ?>">Donate</a>
7778
<a href="<?php echo Common::relativeUrlToAbsolute("//redux.bnetdocs.org/"); ?>">BNETDocs Redux</a>
7879
<a>Account Management</a>
7980
<?php if ($_header_user) { ?>

src/views/DonateHtml.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace BNETDocs\Views;
4+
5+
use \BNETDocs\Models\Donate as DonateModel;
6+
use \CarlBennett\MVC\Libraries\Exceptions\IncorrectModelException;
7+
use \CarlBennett\MVC\Libraries\Model;
8+
use \CarlBennett\MVC\Libraries\Template;
9+
use \CarlBennett\MVC\Libraries\View;
10+
11+
class DonateHtml extends View {
12+
13+
public function getMimeType() {
14+
return "text/html;charset=utf-8";
15+
}
16+
17+
public function render(Model &$model) {
18+
if (!$model instanceof DonateModel) {
19+
throw new IncorrectModelException();
20+
}
21+
(new Template($model, "Donate"))->render();
22+
}
23+
24+
}

0 commit comments

Comments
 (0)