diff --git a/module/doc/control.php b/module/doc/control.php index 786fd3671e..1430bf7696 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1,5 +1,4 @@ view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $lib->name); $this->view->position[] = $this->lang->doc->view; - $this->view->doc = $doc; - $this->view->lib = $lib; - $this->view->type = $type; - $this->view->version = $version ? $version : $doc->version; - $this->view->actions = $this->action->getList('doc', $docID); - $this->view->users = $this->user->getPairs('noclosed,noletter'); - $this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID); - $this->view->keTableCSS = $this->doc->extractKETableCSS($doc->content); + $this->view->doc = $doc; + $this->view->lib = $lib; + $this->view->type = $type; + $this->view->version = $version ? $version : $doc->version; + $this->view->actions = $this->action->getList('doc', $docID); + $this->view->users = $this->user->getPairs('noclosed,noletter'); + $this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID); + $this->view->keTableCSS = $this->doc->extractKETableCSS($doc->content); + $this->view->autoloadPage = $this->doc->checkAutoloadPage($doc); $this->display(); } @@ -1067,6 +1067,8 @@ class doc extends control $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->autoloadPage = $this->doc->checkAutoloadPage($doc); + $this->display(); } diff --git a/module/doc/model.php b/module/doc/model.php index 3962d4ae98..00aae5dcc7 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2651,4 +2651,25 @@ EOT; return array($libs, $libID, $object, $objectID); } + + /** + * Whether the url of link type documents needs to be autoloaded. + * + * @param object $doc + * @access public + * @return bool + */ + public function checkAutoloadPage($doc) + { + $autoloadPage = 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']) $autoloadPage = false; + } + + return $autoloadPage; + } } diff --git a/module/doc/view/content.html.php b/module/doc/view/content.html.php index f5ce4e3698..21f3cbdbd3 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 $autoloadPage) { $url = $doc->content; if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url; diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index 891013a206..f8d97c7da2 100644 --- a/module/doc/view/view.html.php +++ b/module/doc/view/view.html.php @@ -89,7 +89,7 @@ js::set('docID', $doc->id);