diff --git a/README.md b/README.md index 5e95096b..8b1d8263 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Social - [Twitter](https://twitter.com/bludit) - [Facebook](https://www.facebook.com/bluditcms) - [Google+](https://plus.google.com/+Bluditcms) +- [Freenode IRC](https://webchat.freenode.net) channel #bludit [![Join the chat at https://gitter.im/dignajar/bludit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dignajar/bludit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -30,6 +31,7 @@ You only need a web server with PHP support. * Apache with [mod_rewrite](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) module. * Lighttpd with [mod_rewrite](http://redmine.lighttpd.net/projects/1/wiki/docs_modrewrite) module. * Nginx with [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) module. + * PHP Built-in web server Installation guide ------------------ diff --git a/admin/README.md b/admin/README.md deleted file mode 100644 index 46ec6cbf..00000000 --- a/admin/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Bludit - -If you are reading this, you must enable rewrite module. - -Documentation: -- http://docs.bludit.com/en/getting-started/requirements -- http://docs.bludit.com/en/troubleshooting/browser-returns-not-found \ No newline at end of file diff --git a/install.php b/install.php index f2bc046d..9f64bc8e 100644 --- a/install.php +++ b/install.php @@ -23,6 +23,7 @@ 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_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.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); @@ -30,10 +31,20 @@ define('PATH_KERNEL', PATH_ROOT.'kernel'.DS); define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS); define('PATH_LANGUAGES', PATH_ROOT.'languages'.DS); define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS); -define('DOMAIN', getenv('HTTP_HOST')); +define('DOMAIN', $_SERVER['HTTP_HOST']); // HTML PATHs -$base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/'; +$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; +$base = dirname($base); + +if($base!=DS) { + $base = $base.'/'; +} +else { + // Workaround for Windows Web Servers + $base = '/'; +} + define('HTML_PATH_ROOT', $base); // Log separator @@ -220,6 +231,12 @@ function install($adminPassword, $email, $timezoneOffset) error_log($errorText, 0); } + if(!mkdir(PATH_PAGES.'about', $dirpermissions, true)) + { + $errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'about'; + error_log($errorText, 0); + } + if(!mkdir(PATH_PLUGINS_DATABASES.'pages', $dirpermissions, true)) { $errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'pages'; @@ -238,9 +255,15 @@ function install($adminPassword, $email, $timezoneOffset) error_log($errorText, 0); } - if(!mkdir(PATH_UPLOADS, $dirpermissions, true)) + if(!mkdir(PATH_PLUGINS_DATABASES.'about', $dirpermissions, true)) { - $errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS; + $errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'about'; + error_log($errorText, 0); + } + + if(!mkdir(PATH_UPLOADS_PROFILES, $dirpermissions, true)) + { + $errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_PROFILES; error_log($errorText, 0); } @@ -259,6 +282,14 @@ function install($adminPassword, $email, $timezoneOffset) 'status'=>'published', 'date'=>$currentDate, 'position'=>0 + ), + 'about'=>array( + 'description'=>$Language->get('About your site or yourself'), + 'username'=>'admin', + 'tags'=>array(), + 'status'=>'published', + 'date'=>$currentDate, + 'position'=>1 ) ); @@ -267,7 +298,7 @@ function install($adminPassword, $email, $timezoneOffset) // File posts.php $data = array( $firstPostSlug=>array( - 'description'=>'Welcome to Bludit', + 'description'=>$Language->get('Welcome to Bludit'), 'username'=>'admin', 'status'=>'published', 'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'), @@ -279,10 +310,10 @@ function install($adminPassword, $email, $timezoneOffset) // File site.php $data = array( - 'title'=>'Bludit', - 'slogan'=>'cms', + 'title'=>'BLUDIT', + 'slogan'=>'CMS', 'description'=>'', - 'footer'=>Date::current('Y'), + 'footer'=>'Copyright © '.Date::current('Y'), 'language'=>$Language->getCurrentLocale(), 'locale'=>$Language->getCurrentLocale(), 'timezone'=>$timezone, @@ -306,7 +337,7 @@ function install($adminPassword, $email, $timezoneOffset) $data = array( 'admin'=>array( - 'firstName'=>'', + 'firstName'=>$Language->get('Administrator'), 'lastName'=>'', 'twitter'=>'', 'role'=>'admin', @@ -364,6 +395,19 @@ function install($adminPassword, $email, $timezoneOffset) LOCK_EX ); + // File plugins/about/db.php + file_put_contents( + PATH_PLUGINS_DATABASES.'about'.DS.'db.php', + $dataHead.json_encode( + array( + 'position'=>0, + 'label'=>$Language->get('About'), + 'text'=>$Language->get('this-is-a-brief-description-of-yourself-our-your-site') + ), + JSON_PRETTY_PRINT), + LOCK_EX + ); + // File plugins/simplemde/db.php file_put_contents( PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php', @@ -391,19 +435,27 @@ function install($adminPassword, $email, $timezoneOffset) // File index.txt for error page $data = 'Title: '.$Language->get('Error').' - Content: '.$Language->get('The page has not been found'); +Content: '.$Language->get('The page has not been found'); file_put_contents(PATH_PAGES.'error'.DS.'index.txt', $data, LOCK_EX); + // File index.txt for about page + $data = 'Title: '.$Language->get('About').' +Content: +'.$Language->get('the-about-page-is-very-important').' + +'.$Language->get('change-this-pages-content-on-the-admin-panel'); + + file_put_contents(PATH_PAGES.'about'.DS.'index.txt', $data, LOCK_EX); + // File index.txt for welcome post $data = 'Title: '.$Language->get('First post').' Content: -## '.$Language->get('Congratulations you have successfully installed your Bludit').' - -### '.$Language->get('Whats next').' +## '.$Language->get('Whats next').' - '.$Language->get('Manage your Bludit from the admin panel').' - '.$Language->get('Follow Bludit on').' [Twitter](https://twitter.com/bludit) / [Facebook](https://www.facebook.com/bluditcms) / [Google+](https://plus.google.com/+Bluditcms) +- '.$Language->get('Chat with developers and users on Gitter').' - '.$Language->get('Visit the support forum').' - '.$Language->get('Read the documentation for more information').' - '.$Language->get('Share with your friends and enjoy'); @@ -469,7 +521,7 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) - + diff --git a/kernel/abstract/dbjson.class.php b/kernel/abstract/dbjson.class.php index a792164d..1c96feb1 100644 --- a/kernel/abstract/dbjson.class.php +++ b/kernel/abstract/dbjson.class.php @@ -46,7 +46,7 @@ class dbJSON } } - public function restoreDb() + public function restoreDB() { $this->db = $this->dbBackup; return true; @@ -58,6 +58,15 @@ class dbJSON return count($this->db); } + public function getField($field) + { + if(isset($this->db[$field])) { + return $this->db[$field]; + } + + return $this->dbFields[$field]['value']; + } + // Save the JSON file. public function save() { diff --git a/admin/controllers/about.php b/kernel/admin/controllers/about.php similarity index 100% rename from admin/controllers/about.php rename to kernel/admin/controllers/about.php diff --git a/admin/controllers/add-user.php b/kernel/admin/controllers/add-user.php similarity index 100% rename from admin/controllers/add-user.php rename to kernel/admin/controllers/add-user.php diff --git a/admin/controllers/configure-plugin.php b/kernel/admin/controllers/configure-plugin.php similarity index 100% rename from admin/controllers/configure-plugin.php rename to kernel/admin/controllers/configure-plugin.php diff --git a/admin/controllers/dashboard.php b/kernel/admin/controllers/dashboard.php similarity index 64% rename from admin/controllers/dashboard.php rename to kernel/admin/controllers/dashboard.php index 44abfa52..f3f8216a 100644 --- a/admin/controllers/dashboard.php +++ b/kernel/admin/controllers/dashboard.php @@ -3,6 +3,28 @@ // ============================================================================ // Functions // ============================================================================ +function updateBludit() +{ + global $Site; + + // Check if Bludit need to be update. + if($Site->currentBuild() < BLUDIT_BUILD) + { + $directories = array(PATH_POSTS, PATH_PAGES, PATH_PLUGINS_DATABASES, PATH_UPLOADS_PROFILES); + + foreach($directories as $dir) + { + // Check if the directory is already created. + if(!file_exists($dir)) { + // Create the directory recursive. + mkdir($dir, DIR_PERMISSIONS, true); + } + } + + // Set and save the database. + $Site->set(array('currentBuild'=>BLUDIT_BUILD)); + } +} // ============================================================================ // Main before POST @@ -16,6 +38,10 @@ // Main after POST // ============================================================================ +// Try update Bludit +updateBludit(); + +// Get draft posts and schedules $_draftPosts = array(); $_scheduledPosts = array(); foreach($posts as $Post) @@ -28,6 +54,7 @@ foreach($posts as $Post) } } +// Get draft pages $_draftPages = array(); foreach($pages as $Page) { diff --git a/admin/controllers/edit-page.php b/kernel/admin/controllers/edit-page.php similarity index 100% rename from admin/controllers/edit-page.php rename to kernel/admin/controllers/edit-page.php diff --git a/admin/controllers/edit-post.php b/kernel/admin/controllers/edit-post.php similarity index 100% rename from admin/controllers/edit-post.php rename to kernel/admin/controllers/edit-post.php diff --git a/admin/controllers/edit-user.php b/kernel/admin/controllers/edit-user.php similarity index 100% rename from admin/controllers/edit-user.php rename to kernel/admin/controllers/edit-user.php diff --git a/admin/controllers/install-plugin.php b/kernel/admin/controllers/install-plugin.php similarity index 100% rename from admin/controllers/install-plugin.php rename to kernel/admin/controllers/install-plugin.php diff --git a/admin/controllers/install-theme.php b/kernel/admin/controllers/install-theme.php similarity index 100% rename from admin/controllers/install-theme.php rename to kernel/admin/controllers/install-theme.php diff --git a/admin/controllers/login-email.php b/kernel/admin/controllers/login-email.php similarity index 100% rename from admin/controllers/login-email.php rename to kernel/admin/controllers/login-email.php diff --git a/admin/controllers/login.php b/kernel/admin/controllers/login.php similarity index 100% rename from admin/controllers/login.php rename to kernel/admin/controllers/login.php diff --git a/admin/controllers/logout.php b/kernel/admin/controllers/logout.php similarity index 100% rename from admin/controllers/logout.php rename to kernel/admin/controllers/logout.php diff --git a/admin/controllers/new-page.php b/kernel/admin/controllers/new-page.php similarity index 100% rename from admin/controllers/new-page.php rename to kernel/admin/controllers/new-page.php diff --git a/admin/controllers/new-post.php b/kernel/admin/controllers/new-post.php similarity index 100% rename from admin/controllers/new-post.php rename to kernel/admin/controllers/new-post.php diff --git a/admin/controllers/plugins.php b/kernel/admin/controllers/plugins.php similarity index 100% rename from admin/controllers/plugins.php rename to kernel/admin/controllers/plugins.php diff --git a/admin/controllers/settings-advanced.php b/kernel/admin/controllers/settings-advanced.php similarity index 100% rename from admin/controllers/settings-advanced.php rename to kernel/admin/controllers/settings-advanced.php diff --git a/admin/controllers/settings-general.php b/kernel/admin/controllers/settings-general.php similarity index 100% rename from admin/controllers/settings-general.php rename to kernel/admin/controllers/settings-general.php diff --git a/admin/controllers/settings-regional.php b/kernel/admin/controllers/settings-regional.php similarity index 100% rename from admin/controllers/settings-regional.php rename to kernel/admin/controllers/settings-regional.php diff --git a/admin/controllers/settings.php b/kernel/admin/controllers/settings.php similarity index 100% rename from admin/controllers/settings.php rename to kernel/admin/controllers/settings.php diff --git a/admin/controllers/themes.php b/kernel/admin/controllers/themes.php similarity index 100% rename from admin/controllers/themes.php rename to kernel/admin/controllers/themes.php diff --git a/admin/controllers/uninstall-plugin.php b/kernel/admin/controllers/uninstall-plugin.php similarity index 100% rename from admin/controllers/uninstall-plugin.php rename to kernel/admin/controllers/uninstall-plugin.php diff --git a/admin/controllers/user-password.php b/kernel/admin/controllers/user-password.php similarity index 100% rename from admin/controllers/user-password.php rename to kernel/admin/controllers/user-password.php diff --git a/admin/controllers/users.php b/kernel/admin/controllers/users.php similarity index 100% rename from admin/controllers/users.php rename to kernel/admin/controllers/users.php diff --git a/admin/themes/default/css/default.css b/kernel/admin/themes/default/css/default.css similarity index 95% rename from admin/themes/default/css/default.css rename to kernel/admin/themes/default/css/default.css index 7ab788c0..6bf90eff 100644 --- a/admin/themes/default/css/default.css +++ b/kernel/admin/themes/default/css/default.css @@ -26,6 +26,10 @@ background: #1F5FC4; } +.uk-form legend { + width: 70% !important; +} + .uk-navbar-nav > li > a { border: none; height: 70px; @@ -236,9 +240,16 @@ div.plugin-links > span.separator { color: #AAAAAA; } +#jsformplugin textarea { + min-width: 400px; + width: 60%; + min-height: 100px; +} + #jsformplugin input[type=text] { min-width: 400px; width: 60%; + height: 37px; } #jsformplugin input[type="checkbox"] { @@ -249,6 +260,6 @@ div.plugin-links > span.separator { #jsformplugin label.forCheckbox { margin-left: 3px; - margin-bottom: 10px; + margin-bottom: 0px !important; display: inline-block; } diff --git a/admin/themes/default/css/form-file.min.css b/kernel/admin/themes/default/css/form-file.min.css similarity index 100% rename from admin/themes/default/css/form-file.min.css rename to kernel/admin/themes/default/css/form-file.min.css diff --git a/admin/themes/default/css/installer.css b/kernel/admin/themes/default/css/installer.css similarity index 100% rename from admin/themes/default/css/installer.css rename to kernel/admin/themes/default/css/installer.css diff --git a/admin/themes/default/css/jquery.datetimepicker.css b/kernel/admin/themes/default/css/jquery.datetimepicker.css similarity index 100% rename from admin/themes/default/css/jquery.datetimepicker.css rename to kernel/admin/themes/default/css/jquery.datetimepicker.css diff --git a/admin/themes/default/css/login.css b/kernel/admin/themes/default/css/login.css similarity index 100% rename from admin/themes/default/css/login.css rename to kernel/admin/themes/default/css/login.css diff --git a/admin/themes/default/css/placeholder.min.css b/kernel/admin/themes/default/css/placeholder.min.css similarity index 100% rename from admin/themes/default/css/placeholder.min.css rename to kernel/admin/themes/default/css/placeholder.min.css diff --git a/admin/themes/default/css/progress.min.css b/kernel/admin/themes/default/css/progress.min.css similarity index 100% rename from admin/themes/default/css/progress.min.css rename to kernel/admin/themes/default/css/progress.min.css diff --git a/admin/themes/default/css/uikit.almost-flat.min.css b/kernel/admin/themes/default/css/uikit.almost-flat.min.css similarity index 100% rename from admin/themes/default/css/uikit.almost-flat.min.css rename to kernel/admin/themes/default/css/uikit.almost-flat.min.css diff --git a/admin/themes/default/css/upload.min.css b/kernel/admin/themes/default/css/upload.min.css similarity index 100% rename from admin/themes/default/css/upload.min.css rename to kernel/admin/themes/default/css/upload.min.css diff --git a/admin/themes/default/fonts/FontAwesome.otf b/kernel/admin/themes/default/fonts/FontAwesome.otf similarity index 100% rename from admin/themes/default/fonts/FontAwesome.otf rename to kernel/admin/themes/default/fonts/FontAwesome.otf diff --git a/admin/themes/default/fonts/fontawesome-webfont.eot b/kernel/admin/themes/default/fonts/fontawesome-webfont.eot similarity index 100% rename from admin/themes/default/fonts/fontawesome-webfont.eot rename to kernel/admin/themes/default/fonts/fontawesome-webfont.eot diff --git a/admin/themes/default/fonts/fontawesome-webfont.ttf b/kernel/admin/themes/default/fonts/fontawesome-webfont.ttf similarity index 100% rename from admin/themes/default/fonts/fontawesome-webfont.ttf rename to kernel/admin/themes/default/fonts/fontawesome-webfont.ttf diff --git a/admin/themes/default/fonts/fontawesome-webfont.woff b/kernel/admin/themes/default/fonts/fontawesome-webfont.woff similarity index 100% rename from admin/themes/default/fonts/fontawesome-webfont.woff rename to kernel/admin/themes/default/fonts/fontawesome-webfont.woff diff --git a/admin/themes/default/fonts/fontawesome-webfont.woff2 b/kernel/admin/themes/default/fonts/fontawesome-webfont.woff2 similarity index 100% rename from admin/themes/default/fonts/fontawesome-webfont.woff2 rename to kernel/admin/themes/default/fonts/fontawesome-webfont.woff2 diff --git a/kernel/admin/themes/default/img/default.jpg b/kernel/admin/themes/default/img/default.jpg new file mode 100644 index 00000000..2854b892 Binary files /dev/null and b/kernel/admin/themes/default/img/default.jpg differ diff --git a/admin/themes/default/img/favicon.png b/kernel/admin/themes/default/img/favicon.png similarity index 100% rename from admin/themes/default/img/favicon.png rename to kernel/admin/themes/default/img/favicon.png diff --git a/admin/themes/default/index.php b/kernel/admin/themes/default/index.php similarity index 94% rename from admin/themes/default/index.php rename to kernel/admin/themes/default/index.php index dae2d4d1..c5f03ba4 100644 --- a/admin/themes/default/index.php +++ b/kernel/admin/themes/default/index.php @@ -98,7 +98,15 @@ $(document).ready(function() {