Skip to content

Commit 3b6a9b2

Browse files
committed
Add welcome front page
1 parent f3044da commit 3b6a9b2

File tree

8 files changed

+89
-4
lines changed

8 files changed

+89
-4
lines changed

src/controllers/FrontPage.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;
4+
5+
use \BNETDocs\Models\FrontPage as FrontPageModel;
6+
use \CarlBennett\MVC\Libraries\Controller;
7+
use \CarlBennett\MVC\Libraries\Router;
8+
use \CarlBennett\MVC\Libraries\View;
9+
10+
class FrontPage extends Controller {
11+
12+
public function &run( Router &$router, View &$view, array &$args ) {
13+
14+
$model = new FrontPageModel();
15+
16+
$view->render( $model );
17+
18+
$model->_responseCode = 200;
19+
$model->_responseHeaders['Content-Type'] = $view->getMimeType();
20+
$model->_responseTTL = 300;
21+
22+
return $model;
23+
24+
}
25+
26+
}

src/controllers/Legacy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function &run(Router &$router, View &$view, array &$args) {
4646
}
4747

4848
if (is_null($model->url)) {
49-
$model->url = '/news';
49+
$model->url = '/welcome';
5050
$model->is_legacy = false;
5151
$code = 302;
5252
} else {

src/main.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* BNETDocs, the documentation and discussion website for Blizzard protocols
4-
* Copyright (C) 2003-2018 "Arta", Don Cullen "Kyro", Carl Bennett, others
4+
* Copyright (C) 2003-2019 "Arta", Don Cullen "Kyro", Carl Bennett, others
55
* This file is part of BNETDocs.
66
*
77
* BNETDocs is free software: you can redistribute it and/or modify
@@ -258,6 +258,9 @@ function main() {
258258
$router->addRoute( // URL: /user/update
259259
"#^/user/update/?$#", "User\\Update", "User\\UpdateHtml"
260260
);
261+
$router->addRoute( // URL: /welcome
262+
"#^/welcome/?$#", "FrontPage", "FrontPageHtml"
263+
);
261264
$router->addRoute("#.*#", "PageNotFound", "PageNotFoundHtml"); // URL: *
262265
}
263266

src/models/FrontPage.php

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

src/templates/FrontPage.phtml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace BNETDocs\Templates;
4+
5+
use \CarlBennett\MVC\Libraries\Common;
6+
use \CarlBennett\MVC\Libraries\Pair;
7+
8+
$title = "Welcome";
9+
$description = "Welcome to the documentation and discussion for the Classic Battle.net protocol";
10+
11+
$this->opengraph->attach(new Pair("url", "/welcome"));
12+
$this->opengraph->attach(new Pair("type", "article"));
13+
14+
require("./header.inc.phtml");
15+
?>
16+
<article>
17+
<header>Welcome to BNETDocs!</header>
18+
<section>
19+
<p>TODO: make this page fuller.</p>
20+
<p>i Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae suscipit ex. Phasellus tempus scelerisque pulvinar. Donec sollicitudin porta sapien quis accumsan. Quisque ipsum lectus, tempor eget purus eu, bibendum interdum ligula. Morbi quis magna a leo volutpat malesuada. Nulla hendrerit elementum nisl, eget lobortis massa tincidunt in. Pellentesque vestibulum accumsan vulputate. Sed arcu augue, congue ut sapien vitae, pharetra facilisis lacus. Aenean elit metus, cursus vel mauris in, condimentum elementum nisl.</p>
21+
<p>Praesent quam magna, pretium vitae fermentum sed, iaculis ut lectus. Vestibulum dapibus purus vitae bibendum volutpat. Quisque pretium, orci ut facilisis ullamcorper, nulla lectus sodales ex, vel bibendum dui lectus et risus. Vivamus quis vestibulum magna. Mauris tristique arcu mauris, id consequat est convallis vel. Nam at diam sed nisi maximus sodales at nec nunc. Etiam sagittis tellus eget fermentum rutrum. Vivamus et fermentum lacus. Duis dapibus libero quis fermentum feugiat.</p>
22+
</section>
23+
</article>
24+
<?php require("./footer.inc.phtml"); ?>

src/templates/footer.inc.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use \CarlBennett\MVC\Libraries\Common;
99
?>
1010
</main>
1111
<footer class="main-page<?php if (isset($slim_ui) && $slim_ui) { ?> slim<?php } ?>">
12-
<p><?php if ( VersionInfo::$version->bnetdocs ) { ?><a href="https://github.com/BNETDocs/bnetdocs-web/tree/<?php echo VersionInfo::$version->bnetdocs[1]; ?>" rel="external" title="Contribute to the BNETDocs source code!">BNETDocs <?php echo VersionInfo::$version->bnetdocs[0]; ?></a><?php } else { ?>(Development)<?php } ?> &copy; 2003-2018 BNETDocs | <a href="<?php echo Common::relativeUrlToAbsolute("/legal"); ?>" rel="external" title="BNETDocs Legal Policies">Legal page</a></p>
12+
<p><?php if ( VersionInfo::$version->bnetdocs ) { ?><a href="https://github.com/BNETDocs/bnetdocs-web/tree/<?php echo VersionInfo::$version->bnetdocs[1]; ?>" rel="external" title="Contribute to the BNETDocs source code!">BNETDocs <?php echo VersionInfo::$version->bnetdocs[0]; ?></a><?php } else { ?>(Development)<?php } ?> &copy; 2003-2019 BNETDocs | <a href="<?php echo Common::relativeUrlToAbsolute("/legal"); ?>" rel="external" title="BNETDocs Legal Policies">Legal page</a></p>
1313
<p style="font-size:smaller;">
1414
BNETDocs is a documentation and discussion website for Blizzard Entertainment's
1515
Battle.net&trade; and in-game protocols. You hereby acknowledge that BNETDocs

src/templates/header.inc.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ $_campaign_vultr = (
9999
<?php } ?>
100100
</head>
101101
<body>
102-
<header class="main-page"><img src="<?php echo Common::relativeUrlToAbsolute("/a/VSZX0bJ.png"); ?>" style="float:left;margin-right:6px;height:32px;"/> BNETDocs<span id="mobile-nav">&#9776;</span><?php echo $_campaign_vultr; ?></header>
102+
<header class="main-page"><a href="<?php echo Common::relativeUrlToAbsolute('/welcome'); ?>"><img src="<?php echo Common::relativeUrlToAbsolute("/a/VSZX0bJ.png"); ?>" style="float:left;margin-right:6px;height:32px;"/> BNETDocs</a> <span id="mobile-nav">&#9776;</span><?php echo $_campaign_vultr; ?></header>
103103
<?php if (!(isset($slim_ui) && $slim_ui)) { ?>
104104
<nav>
105105
<a>Portal</a>
106+
<a href="<?php echo Common::relativeUrlToAbsolute("/welcome"); ?>">Welcome</a>
106107
<a href="<?php echo Common::relativeUrlToAbsolute("/news"); ?>">News</a>
107108
<a href="<?php echo Common::relativeUrlToAbsolute("/credits"); ?>">Contributors</a>
108109
<a href="<?php echo Common::relativeUrlToAbsolute("/user/index"); ?>">Members</a>

src/views/FrontPageHtml.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\FrontPage as FrontPageModel;
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 FrontPageHtml 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 FrontPageModel) {
19+
throw new IncorrectModelException();
20+
}
21+
(new Template($model, "FrontPage"))->render();
22+
}
23+
24+
}

0 commit comments

Comments
 (0)