refactoring new project structure
This commit is contained in:
parent
c520cf847c
commit
85b10e1098
@ -3,29 +3,16 @@
|
|||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
tab_width = 3
|
|
||||||
|
|
||||||
[*.{php,phpt,inc,phtml}]
|
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_size = 2
|
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
indent_size = 3
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_style = tab
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
max_line_length = 80
|
max_line_length = 80
|
||||||
|
|
||||||
[COMMIT_EDITMSG]
|
[COMMIT_EDITMSG]
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
indent_style = tab
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
max_line_length = 80
|
max_line_length = 80
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// import autoload
|
|
||||||
//Autoloader
|
|
||||||
|
|
||||||
Class Autoloader {
|
//Autoloader
|
||||||
|
class Autoloader {
|
||||||
protected static $extension = ".php";
|
protected static $extension = ".php";
|
||||||
protected static $root = __DIR__;
|
protected static $root = __DIR__;
|
||||||
protected static $files = [];
|
protected static $files = [];
|
||||||
@ -34,7 +33,6 @@ Class Autoloader {
|
|||||||
spl_autoload_register("Autoloader::ClassLoader");
|
spl_autoload_register("Autoloader::ClassLoader");
|
||||||
Autoloader::setRoot('/var/www/dev.steelants.cz/vasek/home-update/');
|
Autoloader::setRoot('/var/www/dev.steelants.cz/vasek/home-update/');
|
||||||
|
|
||||||
|
|
||||||
//Debug
|
//Debug
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set( 'display_errors','1');
|
ini_set( 'display_errors','1');
|
||||||
@ -47,22 +45,22 @@ ini_set('session.cookie_secure', '1');
|
|||||||
session_start ();
|
session_start ();
|
||||||
mb_internal_encoding ("UTF-8");
|
mb_internal_encoding ("UTF-8");
|
||||||
|
|
||||||
//Logs
|
// import configs
|
||||||
|
require_once '../config/config.php';
|
||||||
|
|
||||||
|
// Logs
|
||||||
$logManager = new LogManager();
|
$logManager = new LogManager();
|
||||||
|
|
||||||
//Language
|
// Language
|
||||||
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
||||||
$langMng = new LanguageManager($langTag);
|
$langMng = new LanguageManager($langTag);
|
||||||
$langMng->load();
|
$langMng->load();
|
||||||
|
|
||||||
//DB Conector
|
//D B Conector
|
||||||
//Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
||||||
|
|
||||||
|
// TODO: Přesunout do Login Pohledu
|
||||||
|
|
||||||
//TODO: Přesunout do Login Pohledu
|
|
||||||
$userManager = new UserManager();
|
$userManager = new UserManager();
|
||||||
|
|
||||||
|
|
||||||
// import routes
|
// import routes
|
||||||
require_once '../app/Routes.php';
|
require_once '../app/Routes.php';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
$router = new Router();
|
$router = new Router();
|
||||||
|
|
||||||
$router->setDefault(function(){
|
$router->setDefault(function(){
|
||||||
echo '404';
|
echo $_GET['URL'].': 404';
|
||||||
});
|
});
|
||||||
|
|
||||||
//Pages
|
//Pages
|
||||||
|
@ -17,18 +17,19 @@ class LanguageManager
|
|||||||
|
|
||||||
function load()
|
function load()
|
||||||
{
|
{
|
||||||
$file = './app/lang/en.php';
|
$file = '../lang/en.php';
|
||||||
if (!file_exists($file)){
|
if (!file_exists($file)){
|
||||||
|
echo 'ERROR: en.php not found';
|
||||||
die();
|
die();
|
||||||
//TODO add lng EXEPTIONS
|
//TODO add lng EXEPTIONS
|
||||||
}
|
}
|
||||||
$arrayFirst = include($file);
|
$arrayFirst = include($file);
|
||||||
$file = './app/lang/' . $this->lngCode . '.php';
|
$file = '../lang/' . $this->lngCode . '.php';
|
||||||
$arraySecond = [];
|
$arraySecond = [];
|
||||||
if (file_exists($file)){
|
if (file_exists($file)){
|
||||||
$arraySecond = include($file);
|
$arraySecond = include($file);
|
||||||
}
|
}
|
||||||
$this->lngDatabase = array_merge($arrayFirst,$arraySecond);
|
$this->lngDatabase = array_merge($arrayFirst, $arraySecond);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
class Partial{
|
class Partial{
|
||||||
var $assignedValues = [];
|
private $assignedValues = [];
|
||||||
var $partBuffer;
|
private $partBuffer;
|
||||||
var $path;
|
private $path;
|
||||||
var $debug;
|
private $debug;
|
||||||
|
|
||||||
function __construct($path = "", $debug = false) {
|
function __construct($path = "", $debug = false) {
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
if (!empty('app/templates/part/' . $path . '.phtml') && file_exists('app/templates/part/' . $path . '.phtml')) {
|
if (!empty('../app/templates/part/' . $path . '.phtml') && file_exists('../app/templates/part/' . $path . '.phtml')) {
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
} else {
|
} else {
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
@ -29,6 +29,6 @@ class Partial{
|
|||||||
extract($this->assignedValues);
|
extract($this->assignedValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
require('app/templates/part/' . $this->path . '.phtml');
|
require('../app/templates/part/' . $this->path . '.phtml');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
class Template extends Partial{
|
class Template{
|
||||||
var $assignedValues = [];
|
private $assignedValues = [];
|
||||||
var $partBuffer;
|
private $partBuffer;
|
||||||
var $path;
|
private $path;
|
||||||
var $debug;
|
private $debug;
|
||||||
|
|
||||||
function __construct($path = "", $debug = false) {
|
function __construct($path = "", $debug = false) {
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
if (!empty('app/templates/' . $path . '.phtml') && file_exists('app/templates/' . $path . '.phtml')) {
|
if (!empty('../app/templates/' . $path . '.phtml') && file_exists('../app/templates/' . $path . '.phtml')) {
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
} else {
|
} else {
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
@ -26,9 +26,9 @@ class Template extends Partial{
|
|||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
extract($this->assignedValues);
|
extract($this->assignedValues);
|
||||||
if (!empty('app/controls/' . $this->path . '.php') && file_exists('app/controls/' . $this->path . '.php')) {
|
if (!empty('../app/controls/' . $this->path . '.php') && file_exists('../app/controls/' . $this->path . '.php')) {
|
||||||
include('app/controls/' . $this->path . '.php');
|
include('../app/controls/' . $this->path . '.php');
|
||||||
}
|
}
|
||||||
require_once('app/templates/' . $this->path . '.phtml');
|
require_once('../app/templates/' . $this->path . '.phtml');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
Options -Indexes
|
|
||||||
Options -MultiViews -Indexes
|
|
||||||
|
|
||||||
RewriteEngine On
|
|
||||||
RewriteBase /vasek/home-update/public/
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !.css
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !.js
|
|
||||||
RewriteRule (.*) index.php?url=$1 [QSA,L]
|
|
||||||
|
|
||||||
RewriteCond %{HTTPS} off
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !api.php
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !apiFront.php
|
|
||||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
||||||
|
|
||||||
AddType application/x-httpd-php .php .phtml
|
|
@ -1,5 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo('GET [url]: ' . $_GET['url']);
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../app/Bootstrap.php';
|
require_once __DIR__ . '/../app/Bootstrap.php';
|
||||||
|
Loading…
Reference in New Issue
Block a user