Fixes for Windows and Webservers
This commit is contained in:
parent
7f0211830c
commit
1baace092e
@ -20,15 +20,16 @@ $loadTime = microtime(true);
|
||||
// Security constant
|
||||
define('BLUDIT', true);
|
||||
|
||||
// Directory separator
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// PHP paths
|
||||
define('PATH_ROOT', __DIR__.'/');
|
||||
define('PATH_BOOT', PATH_ROOT.'kernel/boot/');
|
||||
define('PATH_ROOT', __DIR__.DS);
|
||||
define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS);
|
||||
|
||||
// Init
|
||||
require(PATH_BOOT.'init.php');
|
||||
|
||||
|
||||
|
||||
// Admin area
|
||||
if($Url->whereAmI()==='admin')
|
||||
{
|
||||
|
25
install.php
25
install.php
@ -2,17 +2,20 @@
|
||||
// Security constant
|
||||
define('BLUDIT', true);
|
||||
|
||||
// Directory separator
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// PATHs
|
||||
define('PATH_ROOT', __DIR__.'/');
|
||||
define('PATH_CONTENT', PATH_ROOT.'content/');
|
||||
define('PATH_POSTS', PATH_CONTENT.'posts/');
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads/');
|
||||
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
||||
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
||||
define('PATH_ROOT', __DIR__.DS);
|
||||
define('PATH_CONTENT', PATH_ROOT.'content'.DS);
|
||||
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.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('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);
|
||||
|
||||
if(!defined('JSON_PRETTY_PRINT')) {
|
||||
@ -200,7 +203,7 @@ function install($adminPassword, $email)
|
||||
$data = 'Title: Error
|
||||
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
|
||||
$data = 'title: First post
|
||||
@ -217,7 +220,7 @@ What\'s next:
|
||||
- Read the documentation for more information
|
||||
- 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;
|
||||
}
|
||||
@ -319,4 +322,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -38,7 +38,7 @@ class fileContent
|
||||
|
||||
private function build($pathSlug)
|
||||
{
|
||||
if( !Sanitize::pathFile($this->path.$pathSlug.'/', 'index.txt') ) {
|
||||
if( !Sanitize::pathFile($this->path.$pathSlug.DS, 'index.txt') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class fileContent
|
||||
$this->setField('key', $pathSlug);
|
||||
|
||||
$tmp = 0;
|
||||
$lines = file($this->path.$pathSlug.'/index.txt');
|
||||
$lines = file($this->path.$pathSlug.DS.'index.txt');
|
||||
foreach($lines as $lineNumber=>$line)
|
||||
{
|
||||
$parts = array_map('trim', explode(':', $line, 2));
|
||||
|
@ -50,14 +50,14 @@ else
|
||||
}
|
||||
|
||||
// Admin theme init.php
|
||||
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().'/init.php') )
|
||||
include(PATH_ADMIN_THEMES.$Site->adminTheme().'/init.php');
|
||||
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.'init.php') )
|
||||
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.'init.php');
|
||||
|
||||
// Load controller
|
||||
if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') )
|
||||
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
|
||||
|
||||
// Load view and theme
|
||||
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().'/'.$layout['template']) )
|
||||
include(PATH_ADMIN_THEMES.$Site->adminTheme().'/'.$layout['template']);
|
||||
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.$layout['template']) )
|
||||
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.$layout['template']);
|
||||
}
|
||||
|
@ -1,32 +1,34 @@
|
||||
<?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
|
||||
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
|
||||
if(!defined('JSON_PRETTY_PRINT')) {
|
||||
define('JSON_PRETTY_PRINT', 128);
|
||||
|
@ -7,9 +7,9 @@ include(PATH_RULES.'80.plugins.php');
|
||||
include(PATH_RULES.'99.header.php');
|
||||
|
||||
// Theme init.php
|
||||
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().'/init.php') )
|
||||
include(PATH_THEMES.$Site->theme().'/init.php');
|
||||
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'init.php') )
|
||||
include(PATH_THEMES.$Site->theme().DS.'init.php');
|
||||
|
||||
// Theme HTML
|
||||
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().'/index.php') )
|
||||
include(PATH_THEMES.$Site->theme().'/index.php');
|
||||
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'index.php') )
|
||||
include(PATH_THEMES.$Site->theme().DS.'index.php');
|
||||
|
@ -146,7 +146,7 @@ class Page extends fileContent
|
||||
public function children()
|
||||
{
|
||||
$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) {
|
||||
array_push($tmp, basename($path));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user