Ver código fonte

Ticket #4566 - Incorrect canonical URL on some pages.

AntonLV 2 anos atrás
pai
commit
ad9cb39437

+ 6 - 0
modules/base/text/classes/BxBaseModTextPageAuthor.php

@@ -66,7 +66,13 @@ class BxBaseModTextPageAuthor extends BxTemplPage
         $this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName())); // profile display name 
         $this->addMarkers(array('profile_link' => $this->_oProfile->getUrl())); // profile link
     }
+    
+    public function getCode()
+    {
+        BxDolTemplate::getInstance()->setPageUrl('page.php?i=' . $this->_aObject['uri'] . '&profile_id=' . $this->_oProfile->id());
 
+        return parent::getCode();
+    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/forum/install/sql/enable.sql

@@ -91,7 +91,7 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 
 -- PAGE: entries of author
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_forum_author', 'discussions-author', '_bx_forum_page_title_sys_entries_of_author', '_bx_forum_page_title_entries_of_author', @sName, 5, 2147483647, 1, 'page.php?i=discussions-author', '', '', '', 0, 1, 0, 'BxForumPageAuthor', 'modules/boonex/forum/classes/BxForumPageAuthor.php');
+('bx_forum_author', 'discussions-author', '_bx_forum_page_title_sys_entries_of_author', '_bx_forum_page_title_entries_of_author', @sName, 5, 2147483647, 1, '', '', '', '', 0, 1, 0, 'BxForumPageAuthor', 'modules/boonex/forum/classes/BxForumPageAuthor.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 ('bx_forum_author', 1, @sName, '', '_bx_forum_page_block_title_entries_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_forum";s:6:"method";s:18:"my_entries_actions";}', 0, 0, 1, 1),

+ 15 - 5
template/scripts/BxBaseCmtsPageView.php

@@ -9,6 +9,9 @@
 
 class BxBaseCmtsPageView extends BxTemplPage
 {
+    protected $_oCmts;
+    protected $_iCmtId;
+
     public function __construct($aObject, $oTemplate)
     {
         parent::__construct($aObject, $oTemplate);
@@ -20,17 +23,17 @@ class BxBaseCmtsPageView extends BxTemplPage
         $iObjectId = $iObjectId !== false ? bx_process_input($iObjectId, BX_DATA_INT) : 0;
 
         $iCommentId = bx_get('cmt_id');
-        $iCommentId = $iCommentId !== false ? bx_process_input($iCommentId, BX_DATA_INT) : 0;
+        $this->_iCmtId = $iCommentId !== false ? bx_process_input($iCommentId, BX_DATA_INT) : 0;
 
         if(!$sSystem || !$iObjectId)
             return;
 
-        $oCmts = BxDolCmts::getObjectInstance($sSystem, $iObjectId, true);
-        if(!$oCmts)
+        $this->_oCmts = BxDolCmts::getObjectInstance($sSystem, $iObjectId, true);
+        if(!$this->_oCmts)
             return;
 
-        $sObjectTitle = bx_process_output(strip_tags($oCmts->getObjectTitle($iObjectId)));
-        $sObjectUrl = $oCmts->getBaseUrl();
+        $sObjectTitle = bx_process_output(strip_tags($this->_oCmts->getObjectTitle($iObjectId)));
+        $sObjectUrl = $this->_oCmts->getBaseUrl();
 
         $this->addMarkers(array(
             'system' => $sSystem,
@@ -40,6 +43,13 @@ class BxBaseCmtsPageView extends BxTemplPage
             'comment_id' => $iCommentId
         ));
     }
+
+    public function getCode()
+    {
+        BxDolTemplate::getInstance()->setPageUrl($this->_oCmts->getViewUrl($this->_iCmtId));
+
+        return parent::getCode();
+    }
 }
 
 /** @} */