Skip to content

Commit

Permalink
Merge branch 'master' into formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
n0nag0n authored Dec 19, 2022
2 parents 203606c + d60c328 commit 81ada5e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bin/fatfree
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ foreach([ __DIR__.'/../vendor/autoload.php', __DIR__.'/../../../autoload.php' ]
}
}

define("DEVTOOLS_VERSION", '0.1.2');
define("DEVTOOLS_VERSION", '0.3.1');

$fw = Base::instance();
$fw->DEBUG = 3;
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/webtools_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PROJECT_CONFIG = {{ @PROJECT_DATA_DIR.'project_config' }}
CACHE = false

[routes]
GET / = n0nag0n\Root_Controller->index
GET / = n0nag0n\Index_Controller->index
GET /init-environment = n0nag0n\Init_Environment_Controller->indexAction
GET /init-environment/build = n0nag0n\Init_Environment_Controller->build
GET /init-environment/@page = n0nag0n\Init_Environment_Controller->pageAction
Expand Down Expand Up @@ -40,4 +40,4 @@ GET /manage-composer = n0nag0n\Manage_Composer_Controller->indexAction

[maps]

[redirects]
[redirects]
10 changes: 5 additions & 5 deletions controllers/Base_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ abstract class Base_Controller {

public function __construct(\Base $fw) {
$this->fw = $fw;
$has_been_initted = $this->hasBeenInitted();
if($this->hasBeenInitted() === false && strpos($this->fw->URI, '/init-environment') === false) {
$has_been_inited = $this->hasBeenInited();
if($this->hasBeenInited() === false && strpos($this->fw->URI, '/init-environment') === false) {
$this->fw->reroute('/init-environment', false);
}

$this->fw->set('has_been_initted', $has_been_initted);
if($has_been_initted) {
$this->fw->set('has_been_inited', $has_been_inited);
if($has_been_inited) {
$project_config = new Project_Config($fw->DB);
$project_config->load();
$this->fw->set('project_config', $project_config);
Expand All @@ -28,7 +28,7 @@ public function renderHtml(string $file_path, array $hive = []): void {
echo \Template::instance()->render('layout.htm');
}

public function hasBeenInitted(): bool {
public function hasBeenInited(): bool {
return file_exists($this->fw->PROJECT_CONFIG);
}
}
8 changes: 5 additions & 3 deletions controllers/Index_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

namespace n0nag0n;

class Root_Controller extends Base_Controller {
class Index_Controller extends Base_Controller {

public function index(\Base $fw): void {

// if the main config file is missing, start initing this bad boy
if(!$fw->has_been_initted) {
$fw->reroute('/init-environment', false);
if(!$fw->has_been_inited) {
$fw->reroute('/init-environment');
}

$this->renderHtml('index/index.htm');
}

}
2 changes: 1 addition & 1 deletion ui/layout.htm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</button>

<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<check if="{{ @has_been_initted }}">
<check if="{{ @has_been_inited }}">
<ul class="navbar-nav mr-auto">
<li class="nav-item {{ strpos(@URI, 'controllers') !== false ? 'active' : '' }}">
<a class="nav-link" href="/controllers">Controllers</a>
Expand Down

0 comments on commit 81ada5e

Please sign in to comment.