Get things out of /frontend, closes #28

This commit is contained in:
Bojidar Marinov
2016-08-09 17:12:44 +03:00
parent 6b94cbf260
commit 1a58a48ced
12 changed files with 23 additions and 12 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,5 @@
vendor/**
logs/**
logs/**/*.log
src/settings-local.php
**/bower_components/**

View File

@@ -4,7 +4,8 @@ RewriteEngine On
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
RewriteBase /asset-library/frontend
RewriteBase /asset-library
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

2
data/.htaccess Normal file
View File

@@ -0,0 +1,2 @@
Order allow,deny
Deny from all

View File

@@ -1,3 +0,0 @@
<?php
$frontend = true;
include(__DIR__ . '/../api/index.php');

4
index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
$frontend = true;
include(__DIR__ . '/api/index.php');

2
logs/.htaccess Normal file
View File

@@ -0,0 +1,2 @@
Order allow,deny
Deny from all

View File

@@ -1 +0,0 @@
Your Slim Framework application's log files will be written to this directory.

2
src/.htaccess Normal file
View File

@@ -0,0 +1,2 @@
Order allow,deny
Deny from all

View File

@@ -48,7 +48,7 @@ if(isset($frontend) && $frontend) {
if(isset($result['url'])) {
$response = new \Slim\Http\Response(303);
$response = $response->withHeader('Location', dirname($request->getUri()->getBasePath()) . '/frontend/' . $result['url']);
$response = $response->withHeader('Location', $request->getUri()->getBasePath() . '/' . $result['url']);
} else {
$template_names = [
//'/configure' => 'configure',
@@ -77,8 +77,8 @@ if(isset($frontend) && $frontend) {
$errorResponse = new \Slim\Http\Response();
$params = [
'data' => $result,
'basepath' => dirname($request->getUri()->getBasePath()) . '/frontend',
'bowerpath' => dirname($request->getUri()->getBasePath()) . '/bower_components',
'basepath' => $request->getUri()->getBasePath(). '',
'bowerpath' => $request->getUri()->getBasePath() . '/bower_components',
'path' => $path,
'params' => $request->getQueryParams(),
'categories' => [], // Filled later

View File

@@ -3,7 +3,7 @@
// Initializes the connection by sending all categories available
$app->get('/configure', function ($request, $response, $args) {
$app->get('/configure', function ($request, $response, $args) { global $frontend;
$params = $request->getQueryParams();
$category_type = $this->constants['category_type']['addon'];
@@ -28,7 +28,9 @@ $app->get('/configure', function ($request, $response, $args) {
return $response->withJson([
'categories' => $query->fetchAll(),
'token' => $token,
'login_url' => $_SERVER['HTTP_HOST'] . dirname($request->getUri()->getBasePath()) . 'frontend/login#' . urlencode($token),
'login_url' => $_SERVER['HTTP_HOST'] .
(isset($frontend) && $frontend ? dirname($request->getUri()->getBasePath()) : $request->getUri()->getBasePath()) .
'/login#' . urlencode($token),
// ^ TODO: Make those routes actually work
], 200);

2
templates/.htaccess Normal file
View File

@@ -0,0 +1,2 @@
Order allow,deny
Deny from all

View File

@@ -31,7 +31,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/asset-library/frontend">Godot Asset Library</a>
<a class="navbar-brand" href="<?php echo $basepath ?>">Godot Asset Library</a>
</div>
<?php global $gPaths; $gPaths = [$basepath, $path]; function make_nav_link($name, $link='#') { global $gPaths; ?>