From e1866d05d5cf7f0bb4e0ac4256ef04d1ba2c777b Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 30 Jul 2017 14:25:16 +0200 Subject: [PATCH] bug fixes, improves on paginator, admin url filter --- bl-kernel/boot/init.php | 6 +++--- bl-kernel/dbsite.class.php | 2 +- bl-kernel/helpers/paginator.class.php | 12 ++++++------ bl-kernel/helpers/redirect.class.php | 3 +-- bl-kernel/helpers/theme.class.php | 1 - bl-themes/log/php/home.php | 14 ++++++++++++++ bl-themes/massively/php/home.php | 2 +- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index f1cbe32d..c7c8acbd 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -140,8 +140,8 @@ define('EXTREME_FRIENDLY_URL', FALSE); // Permissions for new directories define('DIR_PERMISSIONS', 0755); -// Admin URI filter -define('ADMIN_URI_FILTER', '/admin/'); +// Admin URI filter to access to the admin panel +define('ADMIN_URI_FILTER', 'admin'); // Default language file, in this case is English define('DEFAULT_LANGUAGE_FILE', 'en_US.json'); @@ -247,7 +247,7 @@ define('HTML_PATH_THEME_CSS', HTML_PATH_THEME.'css/'); define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/'); define('HTML_PATH_THEME_IMG', HTML_PATH_THEME.'img/'); -define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/'); +define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.ADMIN_URI_FILTER.'/'); define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'bl-kernel/admin/themes/'.$Site->adminTheme().'/'); define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/'); define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/'); diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php index 6f594723..27347d06 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/dbsite.class.php @@ -62,7 +62,7 @@ class dbSite extends dbJSON // or returns a string with the filter defined on $filter public function uriFilters($filter='') { - $filters['admin'] = ADMIN_URI_FILTER; + $filters['admin'] = '/'.ADMIN_URI_FILTER; $filters['page'] = $this->getField('uriPage'); $filters['tag'] = $this->getField('uriTag'); $filters['category'] = $this->getField('uriCategory'); diff --git a/bl-kernel/helpers/paginator.class.php b/bl-kernel/helpers/paginator.class.php index af7f1977..7ca33f1e 100644 --- a/bl-kernel/helpers/paginator.class.php +++ b/bl-kernel/helpers/paginator.class.php @@ -58,29 +58,29 @@ class Paginator { // Returns the absolute URL for the first page public static function firstPageUrl() { - return self::absoluteUrl( self::firstPage() ); + return self::numberUrl( self::firstPage() ); } // Returns the absolute URL for the last page public static function lastPageUrl() { - return self::absoluteUrl( self::amountOfPages() ); + return self::numberUrl( self::amountOfPages() ); } // Returns the absolute URL for the next page public static function nextPageUrl() { - return self::absoluteUrl( self::nextPage() ); + return self::numberUrl( self::nextPage() ); } // Returns the absolute URL for the previous page public static function prevPageUrl() { - return self::absoluteUrl( self::prevPage() ); + return self::numberUrl( self::prevPage() ); } - // Return the absoulte URL with the current filter - public static function absoluteUrl($pageNumber) + // Return the absoulte URL with the page number + public static function numberUrl($pageNumber) { global $Url; diff --git a/bl-kernel/helpers/redirect.class.php b/bl-kernel/helpers/redirect.class.php index 09ee4dec..a75d263a 100644 --- a/bl-kernel/helpers/redirect.class.php +++ b/bl-kernel/helpers/redirect.class.php @@ -14,8 +14,7 @@ class Redirect { public static function page($page) { - $base = ltrim(ADMIN_URI_FILTER, '/'); - self::url(HTML_PATH_ROOT.$base.$page); + self::url(HTML_PATH_ROOT.ADMIN_URI_FILTER.'/'.$page); } public static function home() diff --git a/bl-kernel/helpers/theme.class.php b/bl-kernel/helpers/theme.class.php index 8f75023a..02faaf66 100644 --- a/bl-kernel/helpers/theme.class.php +++ b/bl-kernel/helpers/theme.class.php @@ -36,7 +36,6 @@ class Theme { { global $Site; $siteUrl = $Site->url(); - $siteUrl = rtrim($siteUrl, '/'); return $siteUrl.ADMIN_URI_FILTER; } diff --git a/bl-themes/log/php/home.php b/bl-themes/log/php/home.php index 1102f37d..b364ecec 100644 --- a/bl-themes/log/php/home.php +++ b/bl-themes/log/php/home.php @@ -68,3 +68,17 @@ + + \ No newline at end of file diff --git a/bl-themes/massively/php/home.php b/bl-themes/massively/php/home.php index 6d2791a9..01715f23 100644 --- a/bl-themes/massively/php/home.php +++ b/bl-themes/massively/php/home.php @@ -42,7 +42,7 @@ } for($i=1; $i<=Paginator::amountOfPages(); $i++) { - echo ''.$i.''; + echo ''.$i.''; } // Show next page link