[geeklog-hg] geeklog: Fixed config page_break_comments setting for last page ...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Nov 25 20:16:05 EST 2013
changeset 9343:e23ec3a9827e
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e23ec3a9827e
user: Tom <websitemaster at cogeco.net>
date: Mon Nov 25 20:15:21 2013 -0500
description:
Fixed config page_break_comments setting for last page displaying on first and last page. Added checks to make sure articles with multiple pages stay within the actual number of pages
diffstat:
public_html/article.php | 32 +++++++++++++++++++++-----------
system/lib-story.php | 16 ++++++++--------
2 files changed, 29 insertions(+), 19 deletions(-)
diffs (82 lines):
diff -r d3198251df58 -r e23ec3a9827e public_html/article.php
--- a/public_html/article.php Sun Nov 24 15:24:50 2013 -0500
+++ b/public_html/article.php Mon Nov 25 20:15:21 2013 -0500
@@ -384,23 +384,33 @@
STORY_renderArticle ($story, 'n', $tmpl, $query));
// display comments or not?
- if ( (is_numeric($mode)) and ($_CONF['allow_page_breaks'] == 1) )
- {
- $story_page = $mode;
+ if ($_CONF['allow_page_breaks'] == 1) {
+ if (!is_numeric($mode)){
+ $story_page = 1;
+ } else {
+ $story_page = $mode;
+ }
$mode = '';
+
if( $story_page <= 0 ) {
$story_page = 1;
}
+
$article_arr = explode( '[page_break]', $story->displayElements('bodytext'));
- $conf = $_CONF['page_break_comments'];
- if (
- ($conf == 'all') or
- ( ($conf =='first') and ($story_page == 1) ) or
- ( ($conf == 'last') and (count($article_arr) == ($story_page)) )
- ) {
+ $page_break_count = count($article_arr);
+ if ($page_break_count > 1) {
+ $conf = $_CONF['page_break_comments'];
+ if (
+ ($conf == 'all') or
+ ( ($conf =='first') and ($story_page == 1) ) or
+ ( ($conf == 'last') and ($page_break_count == $story_page) )
+ ) {
+ $show_comments = true;
+ } else {
+ $show_comments = false;
+ }
+ } else {
$show_comments = true;
- } else {
- $show_comments = false;
}
} else {
$show_comments = true;
diff -r d3198251df58 -r e23ec3a9827e system/lib-story.php
--- a/system/lib-story.php Sun Nov 24 15:24:50 2013 -0500
+++ b/system/lib-story.php Mon Nov 25 20:15:21 2013 -0500
@@ -317,22 +317,22 @@
$story_page = 1;
// page selector
- if( is_numeric( $mode ))
- {
+ if (is_numeric($mode)) {
$story_page = $mode;
- if( $story_page <= 0 )
- {
+ if ($story_page <= 0) {
$story_page = 1;
$mode = 0;
- }
- elseif( $story_page > 1 )
- {
+ } elseif ($story_page > 1) {
$introtext = '';
}
}
$article_array = explode( '[page_break]', $bodytext );
+ $page_break_count = count($article_array);
+ if ($story_page > $page_break_count) { // Can't have page count greate than actual number of pages
+ $story_page = $page_break_count;
+ }
$pagelinks = COM_printPageNavigation(
- $articleUrl, $story_page, count( $article_array ),
+ $articleUrl, $story_page, $page_break_count,
'mode=', $_CONF['url_rewrite'], $LANG01[118]);
if( count( $article_array ) > 1 )
{
More information about the geeklog-cvs
mailing list