From d93d27a0c220039de1b6f0d4dfd02f5e68d8558f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 18 Dec 2015 09:25:12 +0100 Subject: [PATCH 01/10] Fixed: pagination won't show up, if forum topic has e.g 21 posts and the posts/page limit is set to 20. --- e107_core/templates/nextprev_template.php | 6 ++-- e107_plugins/forum/forum_viewtopic.php | 2 +- .../templates/forum_viewtopic_template.php | 28 +++++++++++++------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/e107_core/templates/nextprev_template.php b/e107_core/templates/nextprev_template.php index 8a43b7ab8..c010ae9c0 100644 --- a/e107_core/templates/nextprev_template.php +++ b/e107_core/templates/nextprev_template.php @@ -42,9 +42,9 @@ $NEXTPREV_TEMPLATE['default_separator'] = ' '; /* ****************** Default when Bootstrap is enabled ************** */ -$NEXTPREV_TEMPLATE['bootstrap_start'] = "\n"; -$NEXTPREV_TEMPLATE['bootstrap_nav_caption'] = ''; +$NEXTPREV_TEMPLATE['bootstrap_start'] = "\n"; +$NEXTPREV_TEMPLATE['bootstrap_nav_caption'] = ''; $NEXTPREV_TEMPLATE['bootstrap_nav_first'] = '
  • '; $NEXTPREV_TEMPLATE['bootstrap_nav_prev'] = '
  • '; diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index fb08876f1..8ecf1977c 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -734,7 +734,7 @@ class e107ForumThread exit; } - $totalPosts = $this->threadInfo['thread_total_replies']; // + 1; // add 1 for the original post . ie. not a reply. + $totalPosts = $this->threadInfo['thread_total_replies'] + 1; // add +1 for the original post. ie. not a reply. $this->pages = ceil(($totalPosts) / $this->perPage); $this->noInc = false; } diff --git a/e107_plugins/forum/templates/forum_viewtopic_template.php b/e107_plugins/forum/templates/forum_viewtopic_template.php index 46109d7f6..dd06ebe74 100644 --- a/e107_plugins/forum/templates/forum_viewtopic_template.php +++ b/e107_plugins/forum/templates/forum_viewtopic_template.php @@ -386,15 +386,27 @@ $FORUM_VIEWTOPIC_TEMPLATE['thread'] = " "; $FORUM_VIEWTOPIC_TEMPLATE['end'] = " -
    -

    -
    {GOTOPAGES}
    -
    {QUICKREPLY}
    -
    {BUTTONSX}
    +
    +
    +
    +
    +
    +
    + {GOTOPAGES}
    - {THREADSTATUS} - - "; +
    +
    + {BUTTONSX} +
    +
    +
    +
    +
    + {QUICKREPLY} +
    +
    +{THREADSTATUS} +"; From 6c91b1a552dee0671388f3f49d5dc43400f5c3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 18 Dec 2015 11:09:33 +0100 Subject: [PATCH 02/10] Fixed: proper params for post URLs. URLs always pointed to the last page of topic, but the post was not always there. --- e107_plugins/forum/newforumposts_menu.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/e107_plugins/forum/newforumposts_menu.php b/e107_plugins/forum/newforumposts_menu.php index c654862c7..090d4c072 100755 --- a/e107_plugins/forum/newforumposts_menu.php +++ b/e107_plugins/forum/newforumposts_menu.php @@ -39,9 +39,12 @@ LEFT JOIN `#user` AS u ON u.user_id = p.post_user WHERE {$maxage} p.post_forum IN ({$forumList}) ORDER BY p.post_datestamp DESC LIMIT 0, ".$menu_pref['newforumposts_display']; +// Get forum plugin preferences. +$plugForumPrefs = e107::getPlugConfig('forum')->getPref(); +// New MySQL class instantiation to avoid overrides. +$db = new e_db_mysql(); - - +// TODO: cache menu. if($results = $sql->gen($qry)) { $text = "
      "; @@ -72,7 +75,21 @@ if($results = $sql->gen($qry)) $post = strip_tags($tp->toHTML($row['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap'])); $post = $tp->text_truncate($post, $menu_pref['newforumposts_characters'], $menu_pref['newforumposts_postfix']); - $url = e107::getUrl()->create('forum/thread/last', $row); + // Count previous posts for calculating proper (topic) page number for the current post. + $postNum = $db->count('forum_post', '(*)', "WHERE post_id <= " . $row['post_id'] . " AND post_thread = " . $row['thread_id'] . " ORDER BY post_id ASC"); + // Calculate (topic) page number for the current post. + $postPage = ceil($postNum / vartrue($plugForumPrefs['postspage'], 10)); + // Load thread for passing it to e107::url(). + $thread = $db->retrieve('forum_thread', '*', 'thread_id = ' . $row['thread_id']); + + // Create URL for post. + // like: e107_plugins/forum/forum_viewtopic.php?id=1&p=2#post-55 + $url = e107::url('forum', 'topic', $thread, array( + 'query' => array( + 'p' => $postPage, // proper page number + ), + 'fragment' => 'post-' . $row['post_id'], // jump page to post + )); $text .= "
    • "; From 3b1a5909ba3038b9f15e474b1edaf2c09d571065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 18 Dec 2015 14:10:51 +0100 Subject: [PATCH 03/10] Align counter cols to center. --- .../forum/templates/forum_template.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/e107_plugins/forum/templates/forum_template.php b/e107_plugins/forum/templates/forum_template.php index 31576698b..73ce9da31 100644 --- a/e107_plugins/forum/templates/forum_template.php +++ b/e107_plugins/forum/templates/forum_template.php @@ -101,18 +101,18 @@ $FORUM_TEMPLATE['main-start'] = "{FORUM_BREADCRUMB} $FORUM_TEMPLATE['main-parent'] = " {PARENTNAME} {PARENTSTATUS} - ".LAN_FORUM_0003." - ".LAN_FORUM_0002." - ".LAN_FORUM_0004." - "; - - + ".LAN_FORUM_0003." + ".LAN_FORUM_0002." + ".LAN_FORUM_0004." + "; + + $FORUM_TEMPLATE['main-forum'] = " {NEWFLAG} {FORUMNAME}
      {FORUMDESCRIPTION}{FORUMSUBFORUMS} - {REPLIESX} - {THREADSX} - {LASTPOSTUSER} {LASTPOSTDATE} + {REPLIESX} + {THREADSX} + {LASTPOSTUSER} {LASTPOSTDATE} "; $FORUM_TEMPLATE['main-end'] = "
      {USERINFOX}
    "; From cc7aa558106767a486b86ab4766fbdf774ceb814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 18 Dec 2015 14:21:00 +0100 Subject: [PATCH 04/10] Align counter cols to center. --- e107_plugins/forum/templates/forum_template.php | 2 +- .../forum/templates/forum_viewforum_template.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e107_plugins/forum/templates/forum_template.php b/e107_plugins/forum/templates/forum_template.php index 73ce9da31..d237001c8 100644 --- a/e107_plugins/forum/templates/forum_template.php +++ b/e107_plugins/forum/templates/forum_template.php @@ -101,7 +101,7 @@ $FORUM_TEMPLATE['main-start'] = "{FORUM_BREADCRUMB} $FORUM_TEMPLATE['main-parent'] = " {PARENTNAME} {PARENTSTATUS} - ".LAN_FORUM_0003." + ".LAN_FORUM_0003." ".LAN_FORUM_0002." ".LAN_FORUM_0004." "; diff --git a/e107_plugins/forum/templates/forum_viewforum_template.php b/e107_plugins/forum/templates/forum_viewforum_template.php index db788e60e..d11c9dd6b 100644 --- a/e107_plugins/forum/templates/forum_viewforum_template.php +++ b/e107_plugins/forum/templates/forum_viewforum_template.php @@ -310,7 +310,7 @@ $FORUM_VIEWFORUM_TEMPLATE['item'] = " - {REPLIESX}{VIEWSX} + {REPLIESX}{VIEWSX} {LASTPOSTUSER} {LASTPOSTDATE}
    {ADMINOPTIONS}
    \n"; @@ -320,15 +320,15 @@ $FORUM_VIEWFORUM_TEMPLATE['item-announce'] = $FORUM_VIEWFORUM_TEMPLATE['item'] $FORUM_VIEWFORUM_TEMPLATE['sub-header'] = " ".LAN_FORUM_1002." - ".LAN_FORUM_0003." - ".LAN_FORUM_0002." + ".LAN_FORUM_0003." + ".LAN_FORUM_0002." ".LAN_FORUM_0004." "; $FORUM_VIEWFORUM_TEMPLATE['sub-item'] = "{NEWFLAG}
    {SUB_FORUMTITLE}
    {SUB_DESCRIPTION} - {SUB_REPLIESX} - {SUB_THREADSX} + {SUB_REPLIESX} + {SUB_THREADSX} {SUB_LASTPOSTUSER} {SUB_LASTPOSTDATE} \n"; From 832b70a9d6ae793ce5fb56daafd8bc4bb3c0b554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Thu, 31 Dec 2015 14:03:03 +0100 Subject: [PATCH 05/10] Fixed: PHP Fatal error: Cannot redeclare class social_comment... when using e107::getComment()->getCommentData() method. --- e107_handlers/comment_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index 3c950b919..142d76ca1 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -1306,7 +1306,7 @@ class comment foreach ($files as $file=>$perms) { unset($e_comment, $key); - include (e_PLUGIN.$file."/e_comment.php"); + include_once (e_PLUGIN.$file."/e_comment.php"); if ($e_comment && is_array($e_comment)) { $key = $e_comment['eplug_comment_ids']; From 64e1ce3cd33f850e11cea4feb133fd7842da2248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 1 Jan 2016 14:05:42 +0100 Subject: [PATCH 06/10] Hide "Reply" button on comment items for anonymous users if "anon_post" is disabled. --- e107_core/shortcodes/batch/comment_shortcodes.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index 560cc7713..a97f897c4 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -99,11 +99,14 @@ class comment_shortcodes extends e_shortcode $pref = e107::getPref(); $REPLY = ''; - if($this->var['comment_lock'] != "1" && $this->var['comment_blocked'] < 1) + if(USERID || $pref['anon_post'] == 1) { - if ($thisaction == "comment" && $pref['nested_comments']) + if($this->var['comment_lock'] != "1" && $this->var['comment_blocked'] < 1) { - $REPLY = "".COMLAN_326.""; + if ($thisaction == "comment" && $pref['nested_comments']) + { + $REPLY = "".COMLAN_326.""; + } } } return $REPLY; From 461aa1b91398cf027dcab7d9db3347bc7def9cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 1 Jan 2016 14:18:01 +0100 Subject: [PATCH 07/10] Fixed: path to image, and replaced hardcoded string with constant. --- e107_core/shortcodes/batch/comment_shortcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index a97f897c4..50206f4a9 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -434,10 +434,10 @@ class comment_shortcodes extends e_shortcode if($prov == 'facebook' || $prov == 'twitter') { //TODO Move styling to e107.css - $text = "Share"; + $text = "Share"; $text .= e107::getForm()->checkbox('comment_share',$prov,true); - $text .= "Share"; + $text .= LAN_SHARE; return $text; } } From 73ab0ceac62ce41edfb8d60cbfba12e6edb2ce55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 1 Jan 2016 14:25:03 +0100 Subject: [PATCH 08/10] Fixed: comment nextprev, and replaced hardcoded strings with constants. --- e107_handlers/comment_class.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index 142d76ca1..c3e330041 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -1204,14 +1204,12 @@ class comment //$from = $from + $this->commentsPerPage; - // from calculations are done by eNav() js. - return " - Previous - - Next - - "; - + // from calculations are done by eNav() js. + if($this->totalComments > $this->commentsPerPage) + { + return "" . LAN_PREVIOUS . " + " . LAN_NEXT . ""; + } } From 7516ad880f892adc536031aa9e75ee2141e7f42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Wed, 6 Jan 2016 16:52:10 +0100 Subject: [PATCH 09/10] Fixed: Issue #1289 - menu manager - e107 is not defined. --- e107_handlers/js_manager.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php index c047f1d4b..d6a3e3d17 100644 --- a/e107_handlers/js_manager.php +++ b/e107_handlers/js_manager.php @@ -1030,9 +1030,10 @@ class e_jsmanager $tp = e107::getParser(); $options = $this->arrayMergeDeepArray(array($this->_e_js_settings)); $json = $tp->toJSON($options); - $js = 'jQuery.extend(e107.settings, ' . $json . ');'; - echo ''; - echo "\n"; + echo "\n"; break; case 'framework': // CDN frameworks - rendered before consolidation script (if enabled) From 78d9b5da776b2277e67d3f4db66ca4c9cb1a753b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Thu, 7 Jan 2016 08:03:42 +0100 Subject: [PATCH 10/10] Use e_IMAGE_ABS instead of e_IMAGE. --- e107_core/shortcodes/batch/comment_shortcodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index 50206f4a9..73bf10ce9 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -434,7 +434,7 @@ class comment_shortcodes extends e_shortcode if($prov == 'facebook' || $prov == 'twitter') { //TODO Move styling to e107.css - $text = "Share"; + $text = "Share"; $text .= e107::getForm()->checkbox('comment_share',$prov,true); $text .= LAN_SHARE;