From 9ff0537cda01c62af9ded985aeb0e34d455aa39b Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Sat, 2 Apr 2022 14:57:33 +0800 Subject: [PATCH] * Fix bug #17362. --- module/doc/control.php | 40 ++++++++++++++++++++------------ module/doc/view/content.html.php | 2 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 786fd3671e..6bf0d63eff 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1046,27 +1046,37 @@ class doc extends control } } + $showPageDetails = true; + if(!empty($doc) and $doc->type == 'url') + { + $parsedUrl = parse_url($doc->content); + $urlPort = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''; + $urlDomain = $parsedUrl['host'] . $urlPort; + if($urlDomain == $_SERVER['HTTP_HOST']) $showPageDetails = false; + } + $this->view->customObjectLibs = $customObjectLibs; $this->view->showLibs = $this->config->doc->custom->objectLibs; $this->view->title = ($type == 'book' or $type == 'custom') ? $this->lang->doc->customAB : $object->name; $this->view->position[] = ($type == 'book' or $type == 'custom') ? $this->lang->doc->customAB : $object->name; - $this->view->docID = $docID; - $this->view->doc = $docID ? $doc : ''; - $this->view->type = $type; - $this->view->version = $version; - $this->view->object = $object; - $this->view->objectID = $objectID; - $this->view->objectType = $type; - $this->view->libID = $libID; - $this->view->lib = isset($libs[$libID]) ? $libs[$libID] : new stdclass(); - $this->view->libs = $this->doc->getLibsByObject($type, $objectID); - $this->view->moduleTree = $moduleTree; - $this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable. - $this->view->actions = $docID ? $this->action->getList('doc', $docID) : array(); - $this->view->users = $this->user->getPairs('noclosed,noletter'); - $this->view->preAndNext = $this->doc->getPreAndNextDoc($docID, $libID); + $this->view->docID = $docID; + $this->view->doc = $docID ? $doc : ''; + $this->view->type = $type; + $this->view->version = $version; + $this->view->object = $object; + $this->view->objectID = $objectID; + $this->view->objectType = $type; + $this->view->libID = $libID; + $this->view->lib = isset($libs[$libID]) ? $libs[$libID] : new stdclass(); + $this->view->libs = $this->doc->getLibsByObject($type, $objectID); + $this->view->moduleTree = $moduleTree; + $this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable. + $this->view->actions = $docID ? $this->action->getList('doc', $docID) : array(); + $this->view->users = $this->user->getPairs('noclosed,noletter'); + $this->view->preAndNext = $this->doc->getPreAndNextDoc($docID, $libID); + $this->view->showPageDetails = $showPageDetails; $this->display(); } diff --git a/module/doc/view/content.html.php b/module/doc/view/content.html.php index f5ce4e3698..b6e6acb525 100644 --- a/module/doc/view/content.html.php +++ b/module/doc/view/content.html.php @@ -74,7 +74,7 @@ $sessionString .= session_name() . '=' . session_id();

type == 'url') + if($doc->type == 'url' and $showPageDetails) { $url = $doc->content; if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url;