diff --git a/index.php b/index.php index ed52b50e..946df0ba 100644 --- a/index.php +++ b/index.php @@ -30,6 +30,7 @@ define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS); // Init require(PATH_BOOT.'init.php'); + // Admin area if($Url->whereAmI()==='admin') { require(PATH_BOOT.'admin.php'); diff --git a/install.php b/install.php index 612b0561..92184587 100644 --- a/install.php +++ b/install.php @@ -660,4 +660,4 @@ $(document).ready(function() - \ No newline at end of file + diff --git a/kernel/abstract/dbjson.class.php b/kernel/abstract/dbjson.class.php index 1c96feb1..445b7dcb 100644 --- a/kernel/abstract/dbjson.class.php +++ b/kernel/abstract/dbjson.class.php @@ -106,4 +106,4 @@ class dbJSON return unserialize($data); } -} \ No newline at end of file +} diff --git a/kernel/abstract/plugin.class.php b/kernel/abstract/plugin.class.php index ff0e32f0..889cb029 100644 --- a/kernel/abstract/plugin.class.php +++ b/kernel/abstract/plugin.class.php @@ -191,4 +191,4 @@ class Plugin { // The user can define your own dbFields. } -} \ No newline at end of file +} diff --git a/kernel/admin/controllers/about.php b/kernel/admin/controllers/about.php index 20c8e2fb..9297c685 100644 --- a/kernel/admin/controllers/about.php +++ b/kernel/admin/controllers/about.php @@ -23,4 +23,4 @@ if($Login->role()!=='admin') { // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/edit-post.php b/kernel/admin/controllers/edit-post.php index d10469c5..8bfb274b 100644 --- a/kernel/admin/controllers/edit-post.php +++ b/kernel/admin/controllers/edit-post.php @@ -79,4 +79,4 @@ if(!$dbPosts->postExists($layout['parameters'])) $_Post = buildPost($layout['parameters']); -$layout['title'] .= ' - '.$Language->g('Edit post').' - '.$_Post->title(); \ No newline at end of file +$layout['title'] .= ' - '.$Language->g('Edit post').' - '.$_Post->title(); diff --git a/kernel/admin/controllers/install-plugin.php b/kernel/admin/controllers/install-plugin.php index 7cfacfb8..e4ceeaaa 100644 --- a/kernel/admin/controllers/install-plugin.php +++ b/kernel/admin/controllers/install-plugin.php @@ -33,4 +33,4 @@ foreach($plugins['all'] as $P) } } -Redirect::page('admin', 'plugins'); \ No newline at end of file +Redirect::page('admin', 'plugins'); diff --git a/kernel/admin/controllers/install-theme.php b/kernel/admin/controllers/install-theme.php index 5d623f7a..06437bd1 100644 --- a/kernel/admin/controllers/install-theme.php +++ b/kernel/admin/controllers/install-theme.php @@ -36,4 +36,4 @@ else Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to install the theme: '.$themeDirname); } -Redirect::page('admin', 'themes'); \ No newline at end of file +Redirect::page('admin', 'themes'); diff --git a/kernel/admin/controllers/login-email.php b/kernel/admin/controllers/login-email.php index 28ccbb1d..b5bbef42 100644 --- a/kernel/admin/controllers/login-email.php +++ b/kernel/admin/controllers/login-email.php @@ -83,7 +83,7 @@ function checkGet($args) if( $Login->verifyUserByToken($args['username'], $args['tokenEmail']) ) { // Renew the tokenCRFS. This token will be the same inside the session for multiple forms. - $Security->generateToken(); + $Security->generateTokenCSRF(); Redirect::page('admin', 'dashboard'); return true; @@ -119,4 +119,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/login.php b/kernel/admin/controllers/login.php index a7aca352..9fb4af32 100644 --- a/kernel/admin/controllers/login.php +++ b/kernel/admin/controllers/login.php @@ -23,7 +23,7 @@ function checkPost($args) if( $Login->verifyUser($_POST['username'], $_POST['password']) ) { // Renew the token. This token will be the same inside the session for multiple forms. - $Security->generateToken(); + $Security->generateTokenCSRF(); Redirect::page('admin', 'dashboard'); return true; @@ -51,4 +51,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/logout.php b/kernel/admin/controllers/logout.php index abfc5c51..2857f37b 100644 --- a/kernel/admin/controllers/logout.php +++ b/kernel/admin/controllers/logout.php @@ -23,4 +23,4 @@ if( $Login->logout()) { Redirect::home(); -} \ No newline at end of file +} diff --git a/kernel/admin/controllers/manage-pages.php b/kernel/admin/controllers/manage-pages.php index fd915a8d..37794c32 100644 --- a/kernel/admin/controllers/manage-pages.php +++ b/kernel/admin/controllers/manage-pages.php @@ -18,4 +18,4 @@ // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/manage-posts.php b/kernel/admin/controllers/manage-posts.php index fd915a8d..37794c32 100644 --- a/kernel/admin/controllers/manage-posts.php +++ b/kernel/admin/controllers/manage-posts.php @@ -18,4 +18,4 @@ // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/new-page.php b/kernel/admin/controllers/new-page.php index a8eb25fa..c7540305 100644 --- a/kernel/admin/controllers/new-page.php +++ b/kernel/admin/controllers/new-page.php @@ -40,4 +40,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/new-post.php b/kernel/admin/controllers/new-post.php index d27b7e5e..48e40f4e 100644 --- a/kernel/admin/controllers/new-post.php +++ b/kernel/admin/controllers/new-post.php @@ -45,4 +45,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/plugins.php b/kernel/admin/controllers/plugins.php index 20c8e2fb..9297c685 100644 --- a/kernel/admin/controllers/plugins.php +++ b/kernel/admin/controllers/plugins.php @@ -23,4 +23,4 @@ if($Login->role()!=='admin') { // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/admin/controllers/uninstall-plugin.php b/kernel/admin/controllers/uninstall-plugin.php index cc51150e..6e32daf5 100644 --- a/kernel/admin/controllers/uninstall-plugin.php +++ b/kernel/admin/controllers/uninstall-plugin.php @@ -29,4 +29,4 @@ $pluginClassName = $layout['parameters']; $Plugin = new $pluginClassName; $Plugin->uninstall(); -Redirect::page('admin', 'plugins'); \ No newline at end of file +Redirect::page('admin', 'plugins'); diff --git a/kernel/admin/themes/default/css/default.css b/kernel/admin/themes/default/css/default.css index 3ee8e7f4..bc954195 100644 --- a/kernel/admin/themes/default/css/default.css +++ b/kernel/admin/themes/default/css/default.css @@ -28,6 +28,7 @@ .uk-form legend { width: 70% !important; + margin-top: 40px; } .uk-navbar-nav > li > a { @@ -90,7 +91,7 @@ li.bludit-logo { } h2.title { - margin: 20px 0; + margin: 0 0 20px 0; } button.delete-button { @@ -111,6 +112,10 @@ button.delete-button:hover { height: 400px; } +.bl-view { + margin-top: 25px; + margin-bottom: 25px; +} /* ----------- ALERT ----------- */ @@ -149,7 +154,7 @@ div.login-form { /* ----------- DASHBOARD ----------- */ div.dashboard-links { - margin: 20px 0; + margin: 0 0 25px 0; } div.dashboard-links h4 { diff --git a/kernel/admin/themes/default/css/login.css b/kernel/admin/themes/default/css/login.css index a5ecfcf9..dca6a24b 100644 --- a/kernel/admin/themes/default/css/login.css +++ b/kernel/admin/themes/default/css/login.css @@ -18,6 +18,11 @@ input[type="password"] { /* ----------- BLUDIT ----------- */ +div.login-box { + width: 400px; + max-width: calc(100% - 40px); +} + div.login-box > h1 { font-weight: lighter; letter-spacing: 4px; @@ -26,7 +31,6 @@ div.login-box > h1 { } div.login-form { - width: 400px; text-align: left; } diff --git a/kernel/admin/themes/default/index.php b/kernel/admin/themes/default/index.php index 206d0a6a..f0b79527 100644 --- a/kernel/admin/themes/default/index.php +++ b/kernel/admin/themes/default/index.php @@ -55,77 +55,80 @@ $(document).ready(function() { - +
-
+
- \ No newline at end of file + diff --git a/kernel/admin/themes/default/init.php b/kernel/admin/themes/default/init.php index 62b9f7c0..011c63db 100644 --- a/kernel/admin/themes/default/init.php +++ b/kernel/admin/themes/default/init.php @@ -267,4 +267,4 @@ class HTML { echo $html; } -} \ No newline at end of file +} diff --git a/kernel/admin/themes/default/login.php b/kernel/admin/themes/default/login.php index c635b112..abc03f6d 100644 --- a/kernel/admin/themes/default/login.php +++ b/kernel/admin/themes/default/login.php @@ -1,7 +1,6 @@ - @@ -9,15 +8,15 @@ Bludit - + - - + + - - + + @@ -46,4 +45,4 @@ - \ No newline at end of file + diff --git a/kernel/admin/views/about.php b/kernel/admin/views/about.php index de992e1a..41206e7c 100644 --- a/kernel/admin/views/about.php +++ b/kernel/admin/views/about.php @@ -31,4 +31,4 @@ echo ' echo ' -'; \ No newline at end of file +'; diff --git a/kernel/admin/views/add-user.php b/kernel/admin/views/add-user.php index 2b7230e0..bfd9b2ec 100644 --- a/kernel/admin/views/add-user.php +++ b/kernel/admin/views/add-user.php @@ -7,7 +7,7 @@ HTML::formOpen(array('id'=>'add-user-form', 'class'=>'uk-form-horizontal')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); HTML::formInputText(array( @@ -57,4 +57,4 @@ HTML::formOpen(array('id'=>'add-user-form', 'class'=>'uk-form-horizontal'));
'; -HTML::formClose(); \ No newline at end of file +HTML::formClose(); diff --git a/kernel/admin/views/configure-plugin.php b/kernel/admin/views/configure-plugin.php index 28a4f4f0..564270eb 100644 --- a/kernel/admin/views/configure-plugin.php +++ b/kernel/admin/views/configure-plugin.php @@ -7,7 +7,7 @@ HTML::formOpen(array('id'=>'jsformplugin')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // Print the plugin form @@ -19,4 +19,4 @@ HTML::formOpen(array('id'=>'jsformplugin')); '.$L->g('Cancel').'
'; -HTML::formClose(); \ No newline at end of file +HTML::formClose(); diff --git a/kernel/admin/views/dashboard.php b/kernel/admin/views/dashboard.php index 1310ca99..d1c9f51c 100644 --- a/kernel/admin/views/dashboard.php +++ b/kernel/admin/views/dashboard.php @@ -128,4 +128,4 @@ - \ No newline at end of file + diff --git a/kernel/admin/views/edit-page.php b/kernel/admin/views/edit-page.php index 02ce7c86..2e876200 100644 --- a/kernel/admin/views/edit-page.php +++ b/kernel/admin/views/edit-page.php @@ -7,7 +7,7 @@ HTML::formOpen(array('class'=>'uk-form-stacked')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // Key input @@ -195,4 +195,4 @@ $(document).ready(function() }); - \ No newline at end of file + diff --git a/kernel/admin/views/edit-post.php b/kernel/admin/views/edit-post.php index 8797518a..56e66939 100644 --- a/kernel/admin/views/edit-post.php +++ b/kernel/admin/views/edit-post.php @@ -7,7 +7,7 @@ HTML::formOpen(array('class'=>'uk-form-stacked')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // Key input @@ -155,4 +155,4 @@ $(document).ready(function() { }); - \ No newline at end of file + diff --git a/kernel/admin/views/edit-user.php b/kernel/admin/views/edit-user.php index 89e30a1e..eeaeeac3 100644 --- a/kernel/admin/views/edit-user.php +++ b/kernel/admin/views/edit-user.php @@ -10,7 +10,7 @@ HTML::formOpen(array('id'=>'edit-user-profile-form','class'=>'uk-form-horizontal // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // Security token @@ -122,4 +122,4 @@ $(document).ready(function() { }); - \ No newline at end of file + diff --git a/kernel/admin/views/login-email.php b/kernel/admin/views/login-email.php index 97647fb5..09271fef 100644 --- a/kernel/admin/views/login-email.php +++ b/kernel/admin/views/login-email.php @@ -2,7 +2,7 @@
- +
@@ -16,4 +16,4 @@
- p('Back to login form') ?> \ No newline at end of file + p('Back to login form') ?> diff --git a/kernel/admin/views/login.php b/kernel/admin/views/login.php index e716d09c..21578b34 100644 --- a/kernel/admin/views/login.php +++ b/kernel/admin/views/login.php @@ -2,7 +2,7 @@ - +
@@ -20,4 +20,4 @@
- p('Send me a login access code') ?> \ No newline at end of file + p('Send me a login access code') ?> diff --git a/kernel/admin/views/manage-pages.php b/kernel/admin/views/manage-pages.php index fa8754ac..6e37335c 100644 --- a/kernel/admin/views/manage-pages.php +++ b/kernel/admin/views/manage-pages.php @@ -38,4 +38,4 @@ echo ' echo ' -'; \ No newline at end of file +'; diff --git a/kernel/admin/views/manage-posts.php b/kernel/admin/views/manage-posts.php index 01cf6c7b..11b44f1a 100644 --- a/kernel/admin/views/manage-posts.php +++ b/kernel/admin/views/manage-posts.php @@ -52,4 +52,4 @@ echo ' } ?> - \ No newline at end of file + diff --git a/kernel/admin/views/new-page.php b/kernel/admin/views/new-page.php index 9319170e..b77f99dc 100644 --- a/kernel/admin/views/new-page.php +++ b/kernel/admin/views/new-page.php @@ -7,7 +7,7 @@ HTML::formOpen(array('class'=>'uk-form-stacked')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // ---- LEFT SIDE ---- @@ -170,4 +170,4 @@ $(document).ready(function() }); - \ No newline at end of file + diff --git a/kernel/admin/views/new-post.php b/kernel/admin/views/new-post.php index 3d89fb99..7c63965c 100644 --- a/kernel/admin/views/new-post.php +++ b/kernel/admin/views/new-post.php @@ -7,7 +7,7 @@ HTML::formOpen(array('class'=>'uk-form-stacked')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // ---- LEFT SIDE ---- @@ -140,4 +140,4 @@ $(document).ready(function() { }); - \ No newline at end of file + diff --git a/kernel/admin/views/plugins.php b/kernel/admin/views/plugins.php index 19b40743..438414ea 100644 --- a/kernel/admin/views/plugins.php +++ b/kernel/admin/views/plugins.php @@ -49,4 +49,4 @@ echo ' echo ' -'; \ No newline at end of file +'; diff --git a/kernel/admin/views/settings-advanced.php b/kernel/admin/views/settings-advanced.php index a50958e3..dd583ee6 100644 --- a/kernel/admin/views/settings-advanced.php +++ b/kernel/admin/views/settings-advanced.php @@ -6,9 +6,11 @@ HTML::formOpen(array('class'=>'uk-form-horizontal')); HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); + HTML::legend(array('value'=>$L->g('General'))); + HTML::formSelect(array( 'name'=>'postsperpage', 'label'=>$L->g('Posts per page'), diff --git a/kernel/admin/views/settings-general.php b/kernel/admin/views/settings-general.php index d96c81ab..27e2b61b 100644 --- a/kernel/admin/views/settings-general.php +++ b/kernel/admin/views/settings-general.php @@ -7,9 +7,11 @@ HTML::formOpen(array('class'=>'uk-form-horizontal')); // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); + HTML::legend(array('value'=>$L->g('Site'))); + HTML::formInputText(array( 'name'=>'title', 'label'=>$L->g('Site title'), @@ -48,4 +50,4 @@ HTML::formOpen(array('class'=>'uk-form-horizontal')); '; -HTML::formClose(); \ No newline at end of file +HTML::formClose(); diff --git a/kernel/admin/views/settings-regional.php b/kernel/admin/views/settings-regional.php index bb84a0a3..aee8f67a 100644 --- a/kernel/admin/views/settings-regional.php +++ b/kernel/admin/views/settings-regional.php @@ -6,7 +6,7 @@ HTML::formOpen(array('class'=>'uk-form-horizontal')); HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); HTML::formSelect(array( @@ -63,4 +63,4 @@ $(document).ready(function() { }); - \ No newline at end of file + diff --git a/kernel/admin/views/themes.php b/kernel/admin/views/themes.php index 4554c07d..bed735e7 100644 --- a/kernel/admin/views/themes.php +++ b/kernel/admin/views/themes.php @@ -42,4 +42,4 @@ echo ' echo ' -'; \ No newline at end of file +'; diff --git a/kernel/admin/views/user-password.php b/kernel/admin/views/user-password.php index d51fa456..0b015d67 100644 --- a/kernel/admin/views/user-password.php +++ b/kernel/admin/views/user-password.php @@ -7,7 +7,7 @@ HTML::formOpen(array('id'=>'edit-user-profile-form','class'=>'uk-form-horizontal // Security token HTML::formInputHidden(array( 'name'=>'tokenCSRF', - 'value'=>$Security->getToken() + 'value'=>$Security->getTokenCSRF() )); // Hidden field username @@ -52,4 +52,4 @@ HTML::formOpen(array('id'=>'edit-user-profile-form','class'=>'uk-form-horizontal HTML::formClose(); -?> \ No newline at end of file +?> diff --git a/kernel/admin/views/users.php b/kernel/admin/views/users.php index 77b11e49..2e17ea0c 100644 --- a/kernel/admin/views/users.php +++ b/kernel/admin/views/users.php @@ -35,4 +35,4 @@ foreach($users as $username=>$field) echo ' -'; \ No newline at end of file +'; diff --git a/kernel/ajax/slug.php b/kernel/ajax/slug.php index f6ecb583..8fff04c9 100644 --- a/kernel/ajax/slug.php +++ b/kernel/ajax/slug.php @@ -23,4 +23,4 @@ elseif( $_POST['type']==='post' ) { echo json_encode( array('slug'=>$slug) ); -?> \ No newline at end of file +?> diff --git a/kernel/ajax/uploader.php b/kernel/ajax/uploader.php index 5544c6ae..4546a4c5 100644 --- a/kernel/ajax/uploader.php +++ b/kernel/ajax/uploader.php @@ -58,4 +58,4 @@ exit(json_encode(array( 'filename'=>$tmpName ))); -?> \ No newline at end of file +?> diff --git a/kernel/boot/admin.php b/kernel/boot/admin.php index 09e386f7..8a9706f8 100644 --- a/kernel/boot/admin.php +++ b/kernel/boot/admin.php @@ -15,7 +15,7 @@ $layout['controller'] = $layout['view'] = $layout['slug'] = $explodeSlug[0]; unset($explodeSlug[0]); $layout['parameters'] = implode('/', $explodeSlug); -// Disable Magic Quotes +// Disable Magic Quotes. // Thanks, http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) ) { @@ -24,18 +24,19 @@ if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) $_COOKIE = array_map('stripslashes', $_COOKIE); } -// AJAX +// --- AJAX --- if( $layout['slug']==='ajax' ) { + // Check if the user is loggued. if($Login->isLogged()) { - // Load AJAX file + // Load the ajax file. if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') ) { include(PATH_AJAX.$layout['parameters'].'.php'); } } } -// ADMIN AREA +// --- ADMIN AREA --- else { // Boot rules @@ -47,6 +48,10 @@ else include(PATH_RULES.'99.themes.php'); include(PATH_RULES.'99.security.php'); + // Page not found. + // User not logged. + // Slug is login. + // Slug is login-email. if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') || ($Url->slug()==='login-email') ) { $layout['controller'] = 'login'; @@ -59,28 +64,29 @@ else $layout['view'] = 'login-email'; } - // Generate the token for the user not logged, when the user is loggued the token will be change. - $Security->generateToken(); + // Generate the tokenCSRF for the user not logged, when the user log-in the token will be change. + $Security->generateTokenCSRF(); } - // Plugins before admin area loaded + // Load plugins before the admin area will be load. Theme::plugins('beforeAdminLoad'); - // Admin theme init.php + // Load init.php if the theme has one. if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.'init.php') ) { include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.'init.php'); } - // Load controller + // Load controller. if( Sanitize::pathFile(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().DS.$layout['template']) ) { include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.$layout['template']); } - // Plugins after admin area loaded + // Load plugins after the admin area is loaded. Theme::plugins('afterAdminLoad'); -} \ No newline at end of file + +} diff --git a/kernel/boot/rules/70.posts.php b/kernel/boot/rules/70.posts.php index 4ad9a82a..92320204 100644 --- a/kernel/boot/rules/70.posts.php +++ b/kernel/boot/rules/70.posts.php @@ -172,4 +172,4 @@ else else { buildPostsForPage($Url->pageNumber(), $Site->postsPerPage(), true); } -} \ No newline at end of file +} diff --git a/kernel/boot/rules/99.security.php b/kernel/boot/rules/99.security.php index 54e564d7..c5c79071 100644 --- a/kernel/boot/rules/99.security.php +++ b/kernel/boot/rules/99.security.php @@ -20,9 +20,9 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) { $token = isset($_POST['tokenCSRF']) ? Sanitize::html($_POST['tokenCSRF']) : false; - if( !$Security->validateToken($token) ) + if( !$Security->validateTokenCSRF($token) ) { - Log::set(__METHOD__.LOG_SEP.'Error occurred when trying validate the tokenCSRF. Token CSRF ID: '.$token); + Log::set(__FILE__.LOG_SEP.'Error occurred when trying to validate the tokenCSRF. Token CSRF ID: '.$token); // Destroy the session. Session::destroy(); @@ -38,4 +38,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) // ============================================================================ // Main after POST -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/kernel/boot/rules/99.themes.php b/kernel/boot/rules/99.themes.php index 224aec1c..91ace801 100644 --- a/kernel/boot/rules/99.themes.php +++ b/kernel/boot/rules/99.themes.php @@ -47,4 +47,4 @@ if($database!==false) // Add new words from language theme $Language->add($databaseArray); -} \ No newline at end of file +} diff --git a/kernel/boot/site.php b/kernel/boot/site.php index 5228a048..209b493c 100644 --- a/kernel/boot/site.php +++ b/kernel/boot/site.php @@ -25,4 +25,4 @@ else { } // Plugins after site loaded -Theme::plugins('afterSiteLoad'); \ No newline at end of file +Theme::plugins('afterSiteLoad'); diff --git a/kernel/dblanguage.class.php b/kernel/dblanguage.class.php index 0cc98689..bc56f866 100644 --- a/kernel/dblanguage.class.php +++ b/kernel/dblanguage.class.php @@ -106,4 +106,4 @@ class dbLanguage extends dbJSON return $tmp; } -} \ No newline at end of file +} diff --git a/kernel/dbpages.class.php b/kernel/dbpages.class.php index 9cf55dd1..d325406f 100644 --- a/kernel/dbpages.class.php +++ b/kernel/dbpages.class.php @@ -418,4 +418,4 @@ class dbPages extends dbJSON return $this->db!=$db; } -} \ No newline at end of file +} diff --git a/kernel/dbposts.class.php b/kernel/dbposts.class.php index b78a2cb2..6d260a4d 100644 --- a/kernel/dbposts.class.php +++ b/kernel/dbposts.class.php @@ -466,4 +466,4 @@ class dbPosts extends dbJSON return $this->db!=$db; } -} \ No newline at end of file +} diff --git a/kernel/dbsite.class.php b/kernel/dbsite.class.php index 0cc438da..d9c167da 100644 --- a/kernel/dbsite.class.php +++ b/kernel/dbsite.class.php @@ -150,6 +150,14 @@ class dbSite extends dbJSON return $this->getField('url'); } + public function domain() + { + $parse = parse_url($this->url()); + $domain = $parse['scheme']."://".$parse['host']; + + return $domain; + } + // Returns TRUE if the cli mode is enabled, otherwise FALSE. public function cliMode() { @@ -228,4 +236,4 @@ class dbSite extends dbJSON return date_default_timezone_set($timezone); } -} \ No newline at end of file +} diff --git a/kernel/dbtags.class.php b/kernel/dbtags.class.php index c91b32f7..9b196aeb 100644 --- a/kernel/dbtags.class.php +++ b/kernel/dbtags.class.php @@ -84,4 +84,4 @@ class dbTags extends dbJSON return true; } -} \ No newline at end of file +} diff --git a/kernel/dbusers.class.php b/kernel/dbusers.class.php index 677e79b7..569296fe 100644 --- a/kernel/dbusers.class.php +++ b/kernel/dbusers.class.php @@ -188,4 +188,4 @@ class dbUsers extends dbJSON return true; } -} \ No newline at end of file +} diff --git a/kernel/helpers/alert.class.php b/kernel/helpers/alert.class.php index b0d11bf2..8e51140a 100644 --- a/kernel/helpers/alert.class.php +++ b/kernel/helpers/alert.class.php @@ -31,4 +31,4 @@ class Alert { return Session::get('defined'); } -} \ No newline at end of file +} diff --git a/kernel/helpers/email.class.php b/kernel/helpers/email.class.php index 0f248049..4a86a8e0 100644 --- a/kernel/helpers/email.class.php +++ b/kernel/helpers/email.class.php @@ -26,4 +26,4 @@ class Email { return mail($args['to'], $args['subject'], $message, implode(PHP_EOL, $headers)); } -} \ No newline at end of file +} diff --git a/kernel/helpers/paginator.class.php b/kernel/helpers/paginator.class.php index 88fc9427..4b3bba01 100644 --- a/kernel/helpers/paginator.class.php +++ b/kernel/helpers/paginator.class.php @@ -63,4 +63,4 @@ class Paginator { return $html; } -} \ No newline at end of file +} diff --git a/kernel/helpers/sanitize.class.php b/kernel/helpers/sanitize.class.php index c41134da..0fab0886 100644 --- a/kernel/helpers/sanitize.class.php +++ b/kernel/helpers/sanitize.class.php @@ -76,4 +76,4 @@ class Sanitize { return 0; } -} \ No newline at end of file +} diff --git a/kernel/helpers/session.class.php b/kernel/helpers/session.class.php index b61b5724..d2f19246 100644 --- a/kernel/helpers/session.class.php +++ b/kernel/helpers/session.class.php @@ -82,4 +82,4 @@ return false; } -} \ No newline at end of file +} diff --git a/kernel/helpers/text.class.php b/kernel/helpers/text.class.php index 129722aa..9b445c21 100644 --- a/kernel/helpers/text.class.php +++ b/kernel/helpers/text.class.php @@ -225,4 +225,4 @@ class Text { $string); } -} \ No newline at end of file +} diff --git a/kernel/helpers/valid.class.php b/kernel/helpers/valid.class.php index f8329b0f..6d31497b 100644 --- a/kernel/helpers/valid.class.php +++ b/kernel/helpers/valid.class.php @@ -33,4 +33,4 @@ class Valid { return $tmp && $tmp->format($format)==$date; } -} \ No newline at end of file +} diff --git a/kernel/js/functions.php b/kernel/js/functions.php index cb6c5c67..01a9ed13 100644 --- a/kernel/js/functions.php +++ b/kernel/js/functions.php @@ -71,4 +71,4 @@ function checkSlug(type, text, parentPage, key, writeResponse) }); } - \ No newline at end of file + diff --git a/kernel/login.class.php b/kernel/login.class.php index eea653d3..aa248eb4 100644 --- a/kernel/login.class.php +++ b/kernel/login.class.php @@ -159,4 +159,4 @@ class Login { return Session::destroy(); } -} \ No newline at end of file +} diff --git a/kernel/page.class.php b/kernel/page.class.php index bda128f5..c47638f9 100644 --- a/kernel/page.class.php +++ b/kernel/page.class.php @@ -202,4 +202,4 @@ class Page extends fileContent return $this->getField('authorLastName'); } -} \ No newline at end of file +} diff --git a/kernel/security.class.php b/kernel/security.class.php index 78b8495f..5acaa2c3 100644 --- a/kernel/security.class.php +++ b/kernel/security.class.php @@ -19,16 +19,18 @@ class Security extends dbJSON // ==================================================== // Generate and save the token in Session. - public function generateToken() + public function generateTokenCSRF() { $token = Text::randomText(8); $token = sha1($token); + Log::set(__METHOD__.LOG_SEP.'New tokenCSRF was generated '.$token); + Session::set('tokenCSRF', $token); } // Validate the token. - public function validateToken($token) + public function validateTokenCSRF($token) { $sessionToken = Session::get('tokenCSRF'); @@ -36,12 +38,12 @@ class Security extends dbJSON } // Returns the token. - public function getToken() + public function getTokenCSRF() { return Session::get('tokenCSRF'); } - public function printToken() + public function printTokenCSRF() { echo Session::get('tokenCSRF'); } @@ -134,4 +136,4 @@ class Security extends dbJSON return $ip; } -} \ No newline at end of file +} diff --git a/kernel/url.class.php b/kernel/url.class.php index 65764351..1071134a 100644 --- a/kernel/url.class.php +++ b/kernel/url.class.php @@ -184,4 +184,4 @@ class Url return strlen($b)-strlen($a); } -} \ No newline at end of file +} diff --git a/plugins/about/plugin.php b/plugins/about/plugin.php index 9e30b80f..ebd98dce 100644 --- a/plugins/about/plugin.php +++ b/plugins/about/plugin.php @@ -44,4 +44,4 @@ class pluginAbout extends Plugin { return $html; } -} \ No newline at end of file +} diff --git a/plugins/disqus/plugin.php b/plugins/disqus/plugin.php index fdf59213..ec964e52 100644 --- a/plugins/disqus/plugin.php +++ b/plugins/disqus/plugin.php @@ -121,4 +121,4 @@ class pluginDisqus extends Plugin { return $html; } -} \ No newline at end of file +} diff --git a/plugins/googletools/plugin.php b/plugins/googletools/plugin.php index e126af55..d07180a9 100644 --- a/plugins/googletools/plugin.php +++ b/plugins/googletools/plugin.php @@ -60,4 +60,4 @@ class pluginGoogleTools extends Plugin { return $html; } -} \ No newline at end of file +} diff --git a/plugins/opengraph/plugin.php b/plugins/opengraph/plugin.php index b127f103..89bf4a5f 100644 --- a/plugins/opengraph/plugin.php +++ b/plugins/opengraph/plugin.php @@ -2,34 +2,58 @@ class pluginOpenGraph extends Plugin { + private function getImage($content) + { + $dom = new DOMDocument(); + $dom->loadHTML(''.$content); + $finder = new DomXPath($dom); + $classname = "bludit-img-opengraph"; + $images = $finder->query("//img[contains(@class, '$classname')]"); + + if($images->length>0) + { + // First image from the list + $image = $images->item(0); + + // Get value from attribute src + $coverImage = $image->getAttribute('src'); + + return $coverImage; + } + + return false; + } + public function siteHead() { global $Url, $Site; global $Post, $Page; $og = array( - 'locale' =>$Site->locale(), - 'type' =>'website', - 'title' =>$Site->title(), + 'locale' =>$Site->locale(), + 'type' =>'website', + 'title' =>$Site->title(), 'description' =>$Site->description(), - 'url' =>$Site->url(), - 'image' =>'', - 'siteName' =>$Site->title() + 'url' =>$Site->url(), + 'image' =>'', + 'siteName' =>$Site->title() ); switch($Url->whereAmI()) { case 'post': - $og['type'] = 'article'; + $og['type'] = 'article'; $og['title'] = $Post->title().' | '.$og['title']; $og['description'] = $Post->description(); - $og['url'] = $Post->permalink(true); + $og['url'] = $Post->permalink(true); + $og['image'] = $Site->domain().$this->getImage($Post->content()); break; case 'page': - $og['type'] = 'article'; + $og['type'] = 'article'; $og['title'] = $Page->title().' | '.$og['title']; $og['description'] = $Page->description(); - $og['url'] = $Page->permalink(true); + $og['url'] = $Page->permalink(true); + $og['image'] = $Site->domain().$this->getImage($Page->content()); break; } @@ -44,4 +68,4 @@ class pluginOpenGraph extends Plugin { return $html; } -} \ No newline at end of file +} diff --git a/plugins/pages/plugin.php b/plugins/pages/plugin.php index 324d5bda..669d4407 100644 --- a/plugins/pages/plugin.php +++ b/plugins/pages/plugin.php @@ -89,4 +89,4 @@ class pluginPages extends Plugin { return $html; } -} \ No newline at end of file +} diff --git a/plugins/simplemde/plugin.php b/plugins/simplemde/plugin.php index f362c0a7..b971a0e3 100644 --- a/plugins/simplemde/plugin.php +++ b/plugins/simplemde/plugin.php @@ -109,4 +109,4 @@ class pluginsimpleMDE extends Plugin { return $html; } -} \ No newline at end of file +} diff --git a/themes/pure/index.php b/themes/pure/index.php index 6a16a9b7..5c981515 100644 --- a/themes/pure/index.php +++ b/themes/pure/index.php @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/themes/pure/php/head.php b/themes/pure/php/head.php index 68824463..3f554b4b 100644 --- a/themes/pure/php/head.php +++ b/themes/pure/php/head.php @@ -43,4 +43,4 @@ - \ No newline at end of file + diff --git a/themes/pure/php/home.php b/themes/pure/php/home.php index c738f2b7..5bfb4060 100644 --- a/themes/pure/php/home.php +++ b/themes/pure/php/home.php @@ -56,4 +56,4 @@ \ No newline at end of file +?> diff --git a/themes/pure/php/page.php b/themes/pure/php/page.php index 1859dd65..4c0136d1 100644 --- a/themes/pure/php/page.php +++ b/themes/pure/php/page.php @@ -23,4 +23,4 @@ - \ No newline at end of file + diff --git a/themes/pure/php/post.php b/themes/pure/php/post.php index 7c60da25..f5e34468 100644 --- a/themes/pure/php/post.php +++ b/themes/pure/php/post.php @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/themes/pure/php/sidebar.php b/themes/pure/php/sidebar.php index 4e48937c..a459c298 100644 --- a/themes/pure/php/sidebar.php +++ b/themes/pure/php/sidebar.php @@ -6,4 +6,4 @@ - \ No newline at end of file +