diff --git a/.editorconfig b/.editorconfig index fe9f766..f9002a0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,29 +3,16 @@ 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 -insert_final_newline = true +insert_final_newline = true [*.md] -charset = utf-8 -end_of_line = lf -indent_style = tab -trim_trailing_whitespace = true -insert_final_newline = true max_line_length = 80 [COMMIT_EDITMSG] -charset = utf-8 -end_of_line = lf indent_size = 4 -indent_style = tab -trim_trailing_whitespace = true -insert_final_newline = true -max_line_length = 80 \ No newline at end of file +max_line_length = 80 diff --git a/app/Bootstrap.php b/app/Bootstrap.php index d5076ce..5270f79 100644 --- a/app/Bootstrap.php +++ b/app/Bootstrap.php @@ -1,40 +1,38 @@ '; + //var_dump($directorys); + //echo ''; - //echo '
';
-        //var_dump($directorys);
-        //echo '
'; - - $files = new RecursiveIteratorIterator($directorys, RecursiveIteratorIterator::LEAVES_ONLY); + $files = new RecursiveIteratorIterator($directorys, RecursiveIteratorIterator::LEAVES_ONLY); - $filename = $className . static::$extension; + $filename = $className . static::$extension; - foreach ($files as $key => $file) { - if (strtolower($file->getFilename()) === strtolower($filename) && $file->isReadable()) { - include_once $file->getPathname(); - return; - } - } - } + foreach ($files as $key => $file) { + if (strtolower($file->getFilename()) === strtolower($filename) && $file->isReadable()) { + include_once $file->getPathname(); + return; + } + } + } - static function setRoot($rootPath){ - static::$root = $rootPath; - } + static function setRoot($rootPath){ + static::$root = $rootPath; + } } spl_autoload_register("Autoloader::ClassLoader"); Autoloader::setRoot('/var/www/dev.steelants.cz/vasek/home-update/'); - //Debug error_reporting(E_ALL); ini_set( 'display_errors','1'); @@ -47,22 +45,22 @@ ini_set('session.cookie_secure', '1'); session_start (); mb_internal_encoding ("UTF-8"); -//Logs +// import configs +require_once '../config/config.php'; + +// Logs $logManager = new LogManager(); -//Language +// Language $langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); $langMng = new LanguageManager($langTag); $langMng->load(); -//DB Conector -//Db::connect (DBHOST, DBUSER, DBPASS, DBNAME); +//D B Conector +Db::connect (DBHOST, DBUSER, DBPASS, DBNAME); - - -//TODO: Přesunout do Login Pohledu +// TODO: Přesunout do Login Pohledu $userManager = new UserManager(); - // import routes require_once '../app/Routes.php'; diff --git a/app/Routes.php b/app/Routes.php index 0860ce4..401aebe 100644 --- a/app/Routes.php +++ b/app/Routes.php @@ -3,7 +3,7 @@ $router = new Router(); $router->setDefault(function(){ - echo '404'; + echo $_GET['URL'].': 404'; }); //Pages diff --git a/app/class/LangManager.php b/app/class/LanguageManager.php similarity index 84% rename from app/class/LangManager.php rename to app/class/LanguageManager.php index b85b97f..507bd88 100644 --- a/app/class/LangManager.php +++ b/app/class/LanguageManager.php @@ -17,18 +17,19 @@ class LanguageManager function load() { - $file = './app/lang/en.php'; + $file = '../lang/en.php'; if (!file_exists($file)){ + echo 'ERROR: en.php not found'; die(); //TODO add lng EXEPTIONS } $arrayFirst = include($file); - $file = './app/lang/' . $this->lngCode . '.php'; + $file = '../lang/' . $this->lngCode . '.php'; $arraySecond = []; if (file_exists($file)){ $arraySecond = include($file); } - $this->lngDatabase = array_merge($arrayFirst,$arraySecond); + $this->lngDatabase = array_merge($arrayFirst, $arraySecond); return true; } diff --git a/app/class/LogManager.php b/app/class/LogManager.php index 41c17d8..bf6e3f8 100644 --- a/app/class/LogManager.php +++ b/app/class/LogManager.php @@ -48,7 +48,7 @@ class LogManager $record = "[".date("H:m:s")."][".$type."]" . $value . "\n"; if (strlen($record) > 65 ) { $record = Utilities::stringInsert($record,"\n",65); - } + } fwrite($this->logFile, $record); } diff --git a/app/class/Partial.php b/app/class/Partial.php index f7e672d..b367a2b 100644 --- a/app/class/Partial.php +++ b/app/class/Partial.php @@ -1,13 +1,13 @@ 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; } else { echo '
';
@@ -29,6 +29,6 @@ class Partial{
 			extract($this->assignedValues);
 		}
 
-		require('app/templates/part/' . $this->path . '.phtml');
+		require('../app/templates/part/' . $this->path . '.phtml');
 	}
 }
diff --git a/config_sample.php b/config/config_sample.php
similarity index 100%
rename from config_sample.php
rename to config/config_sample.php
diff --git a/app/lang/cs.php b/lang/cs.php
similarity index 100%
rename from app/lang/cs.php
rename to lang/cs.php
diff --git a/app/lang/en.php b/lang/en.php
similarity index 100%
rename from app/lang/en.php
rename to lang/en.php
diff --git a/app/lang/nl.php b/lang/nl.php
similarity index 100%
rename from app/lang/nl.php
rename to lang/nl.php
diff --git a/app/lang/pl.php b/lang/pl.php
similarity index 100%
rename from app/lang/pl.php
rename to lang/pl.php
diff --git a/library/Template.php b/library/Template.php
index 0ebafb7..b76341d 100644
--- a/library/Template.php
+++ b/library/Template.php
@@ -1,13 +1,13 @@
 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;
 		} else {
 			echo '
';
@@ -26,9 +26,9 @@ class Template extends Partial{
 
 	function render() {
 		extract($this->assignedValues);
-		if (!empty('app/controls/' . $this->path . '.php') && file_exists('app/controls/' . $this->path . '.php')) {
-			include('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');
 		}
-		require_once('app/templates/' . $this->path . '.phtml');
+		require_once('../app/templates/' . $this->path . '.phtml');
 	}
 }
diff --git a/public/.htaccess b/public/.htaccess
deleted file mode 100644
index f2f4481..0000000
--- a/public/.htaccess
+++ /dev/null
@@ -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
diff --git a/public/index.php b/public/index.php
index 1bf36e1..e1517e3 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,5 +1,3 @@