diff --git a/bl-kernel/admin/themes/booty/init.php b/bl-kernel/admin/themes/booty/init.php
index 1c981d98..01e70858 100644
--- a/bl-kernel/admin/themes/booty/init.php
+++ b/bl-kernel/admin/themes/booty/init.php
@@ -241,7 +241,7 @@ EOF;
if (isset($args['id'])) {
$id = $args['id'];
}
- $disabled = isset($args['disabled'])?'disabled':'';
+ $disabled = empty($args['disabled'])?'':'disabled';
$class = 'form-control';
if (isset($args['class'])) {
diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php
index 18643086..912c7080 100644
--- a/bl-kernel/admin/views/edit-content.php
+++ b/bl-kernel/admin/views/edit-content.php
@@ -208,8 +208,6 @@
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
- echo Bootstrap::formTitle(array('title'=>'SEO'));
-
// Tags
echo Bootstrap::formInputText(array(
'name'=>'tags',
@@ -219,6 +217,8 @@
'tip'=>$L->g('Write the tags separated by comma')
));
+ echo Bootstrap::formTitle(array('title'=>'SEO'));
+
// Friendly URL
echo Bootstrap::formInputText(array(
'name'=>'slug',
diff --git a/bl-kernel/admin/views/settings.php b/bl-kernel/admin/views/settings.php
index 0ee86a8b..e8808415 100644
--- a/bl-kernel/admin/views/settings.php
+++ b/bl-kernel/admin/views/settings.php
@@ -212,7 +212,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN.$site->uriFilters('blog'),
- 'disabled'=>!$site->uriFilters('blog')
+ 'disabled'=>Text::isEmpty($site->uriFilters('blog'))
));
echo '
diff --git a/bl-kernel/boot/rules/69.pages.php b/bl-kernel/boot/rules/69.pages.php
index d802c767..cfe30149 100644
--- a/bl-kernel/boot/rules/69.pages.php
+++ b/bl-kernel/boot/rules/69.pages.php
@@ -58,6 +58,13 @@ if ($site->homepage() && $url->whereAmI()==='home') {
// Build specific page
if ($url->whereAmI()==='page') {
+ // Check if the URL has trailing slash
+ $pageKey = $url->slug();
+ if (Text::endsWith($pageKey, '/')) {
+ $pageKey = rtrim($pageKey, '/');
+ Redirect::url(DOMAIN_PAGES.$pageKey);
+ }
+
$content[0] = $page = buildThePage();
}
// Build content by tag
diff --git a/bl-kernel/helpers/redirect.class.php b/bl-kernel/helpers/redirect.class.php
index a75d263a..006936bc 100644
--- a/bl-kernel/helpers/redirect.class.php
+++ b/bl-kernel/helpers/redirect.class.php
@@ -2,14 +2,14 @@
class Redirect {
- public static function url($url)
+ public static function url($url, $httpCode=301)
{
- if(!headers_sent()) {
- header("Location:".$url, TRUE, 302);
+ if (!headers_sent()) {
+ header("Location:".$url, TRUE, $httpCode);
exit;
}
- exit('');
+ exit ('');
}
public static function page($page)
diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php
index fa1b423a..ff27d38d 100644
--- a/bl-kernel/helpers/text.class.php
+++ b/bl-kernel/helpers/text.class.php
@@ -96,9 +96,8 @@ class Text {
public static function endsWith($string, $endsString)
{
- $length = (-1)*self::length($endsString);
-
- return( mb_substr($string, $length)===$endsString );
+ //$length = (-1)*self::length($endsString);
+ return (mb_substr($string, -1)===$endsString);
}
public static function endsWithNumeric($string)
diff --git a/bl-kernel/pages.class.php b/bl-kernel/pages.class.php
index f722e3c3..dea1de76 100644
--- a/bl-kernel/pages.class.php
+++ b/bl-kernel/pages.class.php
@@ -647,6 +647,7 @@ class Pages extends dbJSON {
public function generateKey($text, $parent=false, $returnSlug=false, $oldKey='')
{
global $L;
+ global $site;
if (Text::isEmpty($text)) {
$text = $L->g('empty');
diff --git a/install.php b/install.php
index fbba07b7..d9ad62f4 100644
--- a/install.php
+++ b/install.php
@@ -306,6 +306,7 @@ function install($adminPassword, $timezone)
$dataHead = "".PHP_EOL;
$data = array();
+ $slugs = array();
foreach ($pagesToInstall as $page) {
$slug = $page;
@@ -324,7 +325,7 @@ function install($adminPassword, $timezone)
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
- 'category'=>'',
+ 'category'=>'general',
'uuid'=>md5(uniqid()),
'parent'=>'',
'template'=>'',
@@ -333,6 +334,8 @@ function install($adminPassword, $timezone)
'noarchive'=>false
);
+ array_push($slugs, $slug);
+
file_put_contents(PATH_PAGES.$L->get($slug).DS.FILENAME, $L->get($content), LOCK_EX);
}
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
@@ -438,7 +441,7 @@ function install($adminPassword, $timezone)
// File categories.php
$data = array(
- 'general'=>array('name'=>'General', 'description'=>'', 'template'=>'', 'list'=>array()),
+ 'general'=>array('name'=>'General', 'description'=>'', 'template'=>'', 'list'=>$slugs),
'music'=>array('name'=>'Music', 'description'=>'', 'template'=>'', 'list'=>array()),
'videos'=>array('name'=>'Videos', 'description'=>'', 'template'=>'', 'list'=>array())
);
diff --git a/things-to-do b/things-to-do
index 22aa365f..a13029e1 100644
--- a/things-to-do
+++ b/things-to-do
@@ -11,9 +11,6 @@ Things to do:
-- time for check user logged
-- thumbnails sizes and compression
-- Plugin Links
--- Update CSS for Bootstrap
-
- Plugin sitemap
-- Update CSS for Bootstrap