Fixes for Windows and Webservers
This commit is contained in:
parent
7f0211830c
commit
1baace092e
|
@ -20,15 +20,16 @@ $loadTime = microtime(true);
|
||||||
// Security constant
|
// Security constant
|
||||||
define('BLUDIT', true);
|
define('BLUDIT', true);
|
||||||
|
|
||||||
|
// Directory separator
|
||||||
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
// PHP paths
|
// PHP paths
|
||||||
define('PATH_ROOT', __DIR__.'/');
|
define('PATH_ROOT', __DIR__.DS);
|
||||||
define('PATH_BOOT', PATH_ROOT.'kernel/boot/');
|
define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
require(PATH_BOOT.'init.php');
|
require(PATH_BOOT.'init.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Admin area
|
// Admin area
|
||||||
if($Url->whereAmI()==='admin')
|
if($Url->whereAmI()==='admin')
|
||||||
{
|
{
|
||||||
|
|
23
install.php
23
install.php
|
@ -2,17 +2,20 @@
|
||||||
// Security constant
|
// Security constant
|
||||||
define('BLUDIT', true);
|
define('BLUDIT', true);
|
||||||
|
|
||||||
|
// Directory separator
|
||||||
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
// PATHs
|
// PATHs
|
||||||
define('PATH_ROOT', __DIR__.'/');
|
define('PATH_ROOT', __DIR__.DS);
|
||||||
define('PATH_CONTENT', PATH_ROOT.'content/');
|
define('PATH_CONTENT', PATH_ROOT.'content'.DS);
|
||||||
define('PATH_POSTS', PATH_CONTENT.'posts/');
|
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
|
||||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads/');
|
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||||
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||||
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||||
define('DOMAIN', getenv('HTTP_HOST'));
|
define('DOMAIN', getenv('HTTP_HOST'));
|
||||||
|
|
||||||
$base = (dirname(getenv('SCRIPT_NAME'))=='/')?'/':dirname(getenv('SCRIPT_NAME')).'/';
|
$base = (dirname(getenv('SCRIPT_NAME'))==DS)?DS:dirname(getenv('SCRIPT_NAME')).DS;
|
||||||
define('HTML_PATH_ROOT', $base);
|
define('HTML_PATH_ROOT', $base);
|
||||||
|
|
||||||
if(!defined('JSON_PRETTY_PRINT')) {
|
if(!defined('JSON_PRETTY_PRINT')) {
|
||||||
|
@ -200,7 +203,7 @@ function install($adminPassword, $email)
|
||||||
$data = 'Title: Error
|
$data = 'Title: Error
|
||||||
Content: The page has not been found.';
|
Content: The page has not been found.';
|
||||||
|
|
||||||
file_put_contents(PATH_PAGES.'error/index.txt', $data, LOCK_EX);
|
file_put_contents(PATH_PAGES.'error'.DS.'index.txt', $data, LOCK_EX);
|
||||||
|
|
||||||
// File index.txt for welcome post
|
// File index.txt for welcome post
|
||||||
$data = 'title: First post
|
$data = 'title: First post
|
||||||
|
@ -217,7 +220,7 @@ What\'s next:
|
||||||
- Read the documentation for more information
|
- Read the documentation for more information
|
||||||
- Share with your friend :D';
|
- Share with your friend :D';
|
||||||
|
|
||||||
file_put_contents(PATH_POSTS.$firstPostSlug.'/index.txt', $data, LOCK_EX);
|
file_put_contents(PATH_POSTS.$firstPostSlug.DS.'index.txt', $data, LOCK_EX);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class fileContent
|
||||||
|
|
||||||
private function build($pathSlug)
|
private function build($pathSlug)
|
||||||
{
|
{
|
||||||
if( !Sanitize::pathFile($this->path.$pathSlug.'/', 'index.txt') ) {
|
if( !Sanitize::pathFile($this->path.$pathSlug.DS, 'index.txt') ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class fileContent
|
||||||
$this->setField('key', $pathSlug);
|
$this->setField('key', $pathSlug);
|
||||||
|
|
||||||
$tmp = 0;
|
$tmp = 0;
|
||||||
$lines = file($this->path.$pathSlug.'/index.txt');
|
$lines = file($this->path.$pathSlug.DS.'index.txt');
|
||||||
foreach($lines as $lineNumber=>$line)
|
foreach($lines as $lineNumber=>$line)
|
||||||
{
|
{
|
||||||
$parts = array_map('trim', explode(':', $line, 2));
|
$parts = array_map('trim', explode(':', $line, 2));
|
||||||
|
|
|
@ -50,14 +50,14 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admin theme init.php
|
// Admin theme init.php
|
||||||
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().'/init.php') )
|
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.'init.php') )
|
||||||
include(PATH_ADMIN_THEMES.$Site->adminTheme().'/init.php');
|
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.'init.php');
|
||||||
|
|
||||||
// Load controller
|
// Load controller
|
||||||
if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') )
|
if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') )
|
||||||
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
|
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
|
||||||
|
|
||||||
// Load view and theme
|
// Load view and theme
|
||||||
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().'/'.$layout['template']) )
|
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.$layout['template']) )
|
||||||
include(PATH_ADMIN_THEMES.$Site->adminTheme().'/'.$layout['template']);
|
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.$layout['template']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,34 @@
|
||||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||||
|
|
||||||
// PHP PATHS
|
|
||||||
define('PATH_LANGUAGES', PATH_ROOT.'languages/');
|
|
||||||
define('PATH_THEMES', PATH_ROOT.'themes/');
|
|
||||||
define('PATH_PLUGINS', PATH_ROOT.'plugins/');
|
|
||||||
|
|
||||||
define('PATH_KERNEL', PATH_ROOT.'kernel/');
|
|
||||||
define('PATH_ABSTRACT', PATH_ROOT.'kernel/abstract/');
|
|
||||||
define('PATH_RULES', PATH_ROOT.'kernel/boot/rules/');
|
|
||||||
define('PATH_HELPERS', PATH_ROOT.'kernel/helpers/');
|
|
||||||
define('PATH_AJAX', PATH_ROOT.'kernel/ajax/');
|
|
||||||
define('PATH_JS', PATH_ROOT.'kernel/js/');
|
|
||||||
|
|
||||||
define('PATH_CONTENT', PATH_ROOT.'content/');
|
|
||||||
define('PATH_POSTS', PATH_CONTENT.'posts/');
|
|
||||||
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
|
||||||
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
|
||||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
|
||||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads/');
|
|
||||||
|
|
||||||
define('PATH_ADMIN_THEMES', PATH_ROOT.'admin/themes/');
|
|
||||||
define('PATH_ADMIN_CONTROLLERS', PATH_ROOT.'admin/controllers/');
|
|
||||||
define('PATH_ADMIN_VIEWS', PATH_ROOT.'admin/views/');
|
|
||||||
|
|
||||||
// Log
|
|
||||||
// Log separator
|
// Log separator
|
||||||
define('LOG_SEP', ' | ');
|
define('LOG_SEP', ' | ');
|
||||||
|
|
||||||
|
// PHP PATHS
|
||||||
|
|
||||||
|
// PATH_ROOT and PATH_BOOT are defined in index.php
|
||||||
|
define('PATH_LANGUAGES', PATH_ROOT.'languages'.DS);
|
||||||
|
define('PATH_THEMES', PATH_ROOT.'themes'.DS);
|
||||||
|
define('PATH_PLUGINS', PATH_ROOT.'plugins'.DS);
|
||||||
|
|
||||||
|
define('PATH_KERNEL', PATH_ROOT.'kernel'.DS);
|
||||||
|
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
|
||||||
|
define('PATH_RULES', PATH_KERNEL.'boot'.DS.'rules'.DS);
|
||||||
|
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
|
||||||
|
define('PATH_AJAX', PATH_KERNEL.'ajax'.DS);
|
||||||
|
define('PATH_JS', PATH_KERNEL.'js'.DS);
|
||||||
|
|
||||||
|
define('PATH_CONTENT', PATH_ROOT.'content'.DS);
|
||||||
|
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
|
||||||
|
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||||
|
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||||
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||||
|
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||||
|
|
||||||
|
define('PATH_ADMIN', PATH_ROOT.'admin'.DS);
|
||||||
|
define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
|
||||||
|
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
|
||||||
|
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
|
||||||
|
|
||||||
// JSON pretty print
|
// JSON pretty print
|
||||||
if(!defined('JSON_PRETTY_PRINT')) {
|
if(!defined('JSON_PRETTY_PRINT')) {
|
||||||
define('JSON_PRETTY_PRINT', 128);
|
define('JSON_PRETTY_PRINT', 128);
|
||||||
|
|
|
@ -7,9 +7,9 @@ include(PATH_RULES.'80.plugins.php');
|
||||||
include(PATH_RULES.'99.header.php');
|
include(PATH_RULES.'99.header.php');
|
||||||
|
|
||||||
// Theme init.php
|
// Theme init.php
|
||||||
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().'/init.php') )
|
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'init.php') )
|
||||||
include(PATH_THEMES.$Site->theme().'/init.php');
|
include(PATH_THEMES.$Site->theme().DS.'init.php');
|
||||||
|
|
||||||
// Theme HTML
|
// Theme HTML
|
||||||
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().'/index.php') )
|
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'index.php') )
|
||||||
include(PATH_THEMES.$Site->theme().'/index.php');
|
include(PATH_THEMES.$Site->theme().DS.'index.php');
|
||||||
|
|
|
@ -146,7 +146,7 @@ class Page extends fileContent
|
||||||
public function children()
|
public function children()
|
||||||
{
|
{
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$paths = glob(PATH_PAGES.$this->getField('key').'/*', GLOB_ONLYDIR);
|
$paths = glob(PATH_PAGES.$this->getField('key').DS.'*', GLOB_ONLYDIR);
|
||||||
foreach($paths as $path) {
|
foreach($paths as $path) {
|
||||||
array_push($tmp, basename($path));
|
array_push($tmp, basename($path));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue