Merge branch 'sprint/fixbug_hufangzhou_17362' into 'master'

* Fix bug #17362.

See merge request easycorp/zentaopms!2740
This commit is contained in:
王怡栋
2022-04-02 08:05:56 +00:00
4 changed files with 34 additions and 11 deletions
+11 -9
View File
@@ -1,5 +1,4 @@
<?php
/**
* The control file of doc module of ZenTaoPMS.
*
@@ -538,14 +537,15 @@ class doc extends control
$this->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();
}
+21
View File
@@ -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;
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ $sessionString .= session_name() . '=' . session_id();
</p>
<?php endif;?>
<?php
if($doc->type == 'url')
if($doc->type == 'url' and $autoloadPage)
{
$url = $doc->content;
if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url;
+1 -1
View File
@@ -89,7 +89,7 @@ js::set('docID', $doc->id);
<div class="detail no-padding">
<div class="detail-content article-content no-margin no-padding">
<?php
if($doc->type == 'url')
if($doc->type == 'url' and $autoloadPage)
{
$url = $doc->content;
if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url;