Bug fixed on paginator for tags

This commit is contained in:
dignajar 2016-01-16 21:11:58 -03:00
parent a2a744c808
commit 26b1ee0cec
4 changed files with 29 additions and 2 deletions

View File

@ -1,5 +1,7 @@
AddDefaultCharset UTF-8
DirectorySlash Off
<IfModule mod_rewrite.c>
# Enable rewrite rules

View File

@ -97,6 +97,10 @@ if(isset($_GET['language'])) {
$localeFromHTTP = Sanitize::html($_GET['language']);
}
if( !Sanitize::pathFile(PATH_LANGUAGES.$localeFromHTTP) ) {
$localeFromHTTP = 'en_US';
}
$Language = new dbLanguage($localeFromHTTP);
// --- LOCALE ---
@ -187,6 +191,10 @@ function checkSystem()
array_push($stdOut, $tmp);
}
// Try to create the directory content
@mkdir(PATH_CONTENT, $dirpermissions, true);
// Check if the directory content is writeable.
if(!is_writable(PATH_CONTENT))
{
$errorText = 'Writing test failure, check directory content permissions. (ERR_205)';

View File

@ -9,6 +9,11 @@ if($Url->whereAmI()=='admin') {
$postPerPage = POSTS_PER_PAGE_ADMIN;
$numberOfPosts = $dbPosts->numberPost(true); // published and drafts
}
elseif($Url->whereAmI()=='tag') {
$postPerPage = $Site->postsPerPage();
$tagKey = $Url->slug();
$numberOfPosts = $dbTags->countPostsByTag($tagKey);
}
else {
$postPerPage = $Site->postsPerPage();
$numberOfPosts = $dbPosts->numberPost(false); // published

View File

@ -27,6 +27,18 @@ class Paginator {
public static function html($textPrevPage=false, $textNextPage=false, $showPageNumber=false)
{
global $Language;
global $Url;
$url = trim(DOMAIN_BASE,'/');
$filter = '';
if($Url->whereAmI()=='tag') {
$filter = trim($Url->filters('tag'), '/');
$url = $url.'/'.$filter.'/'.$Url->slug();
}
else {
$url = $url.'/';
}
$html = '<div id="paginator">';
$html .= '<ul>';
@ -38,7 +50,7 @@ class Paginator {
}
$html .= '<li class="left">';
$html .= '<a href="'.HTML_PATH_ROOT.'?page='.self::get('prevPage').'">'.$textPrevPage.'</a>';
$html .= '<a href="'.$url.'?page='.self::get('prevPage').'">'.$textPrevPage.'</a>';
$html .= '</li>';
}
@ -53,7 +65,7 @@ class Paginator {
}
$html .= '<li class="right">';
$html .= '<a href="'.HTML_PATH_ROOT.'?page='.self::get('nextPage').'">'.$textNextPage.'</a>';
$html .= '<a href="'.$url.'?page='.self::get('nextPage').'">'.$textNextPage.'</a>';
$html .= '</li>';
}