Navigation helper

Permalink Browser Info Environment
Hi

I believe I found, and fixed, an error with regard to External pages in the site tree. The problem is when the external link has a subpage e.g.http://www.domain.com/subpage, that the helper override strips anything after the main url. The fix was simple - check whether the cObj is an external link, if not, proceed with the rest of the helper, otherwise just return the url.

<?php
defined('C5_EXECUTE') or die("Access Denied.");
class NavigationHelper extends Concrete5_Helper_Navigation {
  public function getLinkToCollection(&$cObj, $appendBaseURL = false, $ignoreUrlRewriting = false) {
    $url = parent::getLinkToCollection($cObj, $appendBaseURL, $ignoreUrlRewriting);
    Loader::model("mapping", "multiple_domains");
    $map = MultipleDomainsMapping::getByCurrentDomain();
    if(!$cObj->cPointerExternalLink) {
      if (is_object($map) && is_object($p = $map->getMappedPage())) {
        if ($p->getCollectionID() > 0) {
          // Replace the first occurrence of the sub-domain URL
          $url = preg_replace('#' . $p->getCollectionPath() . '#', "", $url);
        }
      }
      $find = DISPATCHER_FILENAME . "/";


cheers

Type: Discussion
Status: Legacy: Invalid
boonier
View Replies:
Mainio replied on at Permalink Reply
Mainio

concrete5 Environment Information

# concrete5 Version
5.6.3.3

# concrete5 Packages
Add Multiple Pages (2.1.1), Custom Contact Form - Basic (2.0), Database Case Sensitivity Migration (1.1.2), Designer Content (3.1.1), Extreme Clean (1.0), Form Tableless Layout (1.2.1), Maintenance Editor (1.2.2), Manual Nav (1.3), Multiple Domains (1.4.7), Page Redirect (1.4), Page Selector Attribute (1.1), PHP block by ND (1.0).

# concrete5 Overrides
blocks/search, blocks/autonav, blocks/stack_slider, blocks/html, blocks/feature_box, blocks/stack_grid, blocks/content, blocks/accordion, blocks/stack_slider_item, blocks/google_map, blocks/text_image_ext, blocks/sidebar_block_one, blocks/manual_nav, blocks/responsive_video, blocks/multiple_domains_autonav, blocks/tags, blocks/form, blocks/image, blocks/file, blocks/page_list, blocks/feature_box_ext, blocks/date_nav, blocks/layout_two_column, blocks/text_image, elements/tracking.php, helpers/navigation.php, libraries/view.php, libraries/request.php, libraries/page_cache, single_pages/page_not_found.php, themes/basesite_v2.1

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.6.3

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mysql, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, Phar, posix, pspell, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
sql.safe_mode - Off
upload_max_filesize - 2M
ldap.max_links - Unlimited
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.